geeksiddhant commited on
Commit
89adeb4
·
verified ·
1 Parent(s): 9c05b71

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -0
app.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import gradio as gr
3
+ import requests
4
+
5
+ BACKEND_URL = os.environ.get("BACKEND_URL", "http://127.0.0.1:8000/diagnose")
6
+
7
+
8
+ def diagnose(message, history):
9
+ try:
10
+ response = requests.post(
11
+ BACKEND_URL,
12
+ json={"workflow_description": message},
13
+ timeout=60,
14
+ )
15
+ response.raise_for_status()
16
+ return response.text
17
+ except requests.RequestException as e:
18
+ return f"Could not reach the backend.\n\n{e}"
19
+
20
+
21
+ demo = gr.ChatInterface(
22
+ diagnose,
23
+ title="Workflow Diagnoser",
24
+ description="Describe one repeated task you do at work.",
25
+ )
26
+
27
+ if __name__ == "__main__":
28
+ demo.launch()