Spaces:
Sleeping
Sleeping
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) | |