Skip to content

Commit

Permalink
Add gradio to requirements.txt and add frontend demo
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Chen authored and Mark Chen committed Feb 6, 2024
1 parent ca1e09f commit 7b23ee7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ python-multipart
config
PyGithub
httpx
pytest
pytest
gradio
3 changes: 3 additions & 0 deletions scripts/app_start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Run two commands in the background at the same time
cd ../src
python3 -m uvicorn index.main:app --reload & python3 app/main.py
14 changes: 14 additions & 0 deletions src/app/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import gradio as gr
import requests

def echo(message, history):
# Post the message to the server
response = requests.post("http://127.0.0.1:8000/api/chat/gpt3", data={"user_request": message})
# Return the response
llm_output = response.json()["result"]['content']

return llm_output

demo = gr.ChatInterface(fn=echo, examples=["What is OpenAI?", "What is LLM?"], title="LLM Chatbot")

demo.launch()

0 comments on commit 7b23ee7

Please sign in to comment.