File size: 658 Bytes
c990dfc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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()