-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add gradio to requirements.txt and add frontend demo
- Loading branch information
Mark Chen
authored and
Mark Chen
committed
Feb 6, 2024
1 parent
ca1e09f
commit 7b23ee7
Showing
3 changed files
with
19 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,5 @@ python-multipart | |
config | ||
PyGithub | ||
httpx | ||
pytest | ||
pytest | ||
gradio |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |