Spaces:
Runtime error
Runtime error
Download app.py from QL2023/GAIL_test1: direct link, hf CLI and curl.
- Browser
- Download file 758 Bytes
-
https://huggingface.co/spaces/QL2023/GAIL_test1/resolve/main/app.py
- Command line
-
hf download hf://spaces/QL2023/GAIL_test1/app.py
-
curl -L -o app.py https://huggingface.co/spaces/QL2023/GAIL_test1/resolve/main/app.py
758 Bytes
| import os | |
| import requests | |
| import gradio as gr | |
| address = os.getenv("address") | |
| thread = "new" | |
| def reset(): | |
| global thread | |
| thread = "new" | |
| def chat_history(message,history): | |
| global thread | |
| response = requests.post(address, json={ | |
| "query": message, | |
| "thread": thread, | |
| "cc": "dummy" | |
| }).json() | |
| thread = response['thread'] | |
| return response['result'] | |
| chat = gr.ChatInterface( | |
| chat_history, | |
| chatbot=gr.Chatbot(), | |
| title="GAIL v0.1", | |
| description="Learn AI with AI", | |
| theme="soft", | |
| examples=["COURSE ROADMAP🚦", "LET'S BEGIN! 🚀 "], | |
| retry_btn=None, | |
| undo_btn=None, | |
| clear_btn="Clear", | |
| ) | |
| with gr.Blocks() as demo: | |
| chat.render() | |
| gr.Button("Reset").click(reset) | |
| demo.launch() | |