File size: 526 Bytes
c9ffc6b
 
 
 
fe7f68c
 
 
 
 
 
 
 
 
 
 
 
c9ffc6b
fe7f68c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import gradio as gr
import requests

def chatbot_response(user_input: str, history) -> str:
    r = requests.get(  # changed to GET
        f"http://localhost:3000/chat/?query={user_input}"
    )
    response = r.json()
    return response.get("answer", "No answer received from API.")

demo = gr.ChatInterface(
    fn=chatbot_response,
    title="Name of demo goes here",
    description="Description goes here",
    type="messages"  # new line added
)

demo.launch(server_name="localhost", server_port=4000, show_api=False)