Download app.py from dev2180/second: direct link, hf CLI and curl.
- Browser
- Download file 658 Bytes
-
https://huggingface.co/spaces/dev2180/second/resolve/main/app.py
- Command line
-
hf download hf://spaces/dev2180/second/app.py
-
curl -L -o app.py https://huggingface.co/spaces/dev2180/second/resolve/main/app.py
658 Bytes
| import os | |
| import gradio as gr | |
| import requests | |
| BACKEND_URL = os.environ.get("BACKEND_URL", "http://127.0.0.1:8000/diagnose") | |
| def diagnose(message, history): | |
| try: | |
| response = requests.post( | |
| BACKEND_URL, | |
| json={"workflow_description": message}, | |
| timeout=60, | |
| ) | |
| response.raise_for_status() | |
| return response.text | |
| except requests.RequestException as e: | |
| return f"Could not reach the backend.\n\n{e}" | |
| demo = gr.ChatInterface( | |
| diagnose, | |
| title="Workflow Diagnoser", | |
| description="Describe one repeated task you do at work.", | |
| ) | |
| if __name__ == "__main__": | |
| demo.launch() | |