|
import gradio as gr |
|
import requests |
|
|
|
|
|
def get_response(query): |
|
try: |
|
|
|
response = requests.post("http://164.52.213.121:8000/chat", data=query) |
|
|
|
response.raise_for_status() |
|
|
|
return response.json().get("response", "No response from server.") |
|
except requests.exceptions.RequestException as e: |
|
return f"Error: {e}" |
|
|
|
|
|
iface = gr.Interface( |
|
fn=get_response, |
|
inputs=gr.Textbox(lines=2, placeholder="Enter your query here..."), |
|
outputs="text", |
|
title="Chat with Model", |
|
description="Enter a query and get a response from the model." |
|
) |
|
|
|
|
|
if __name__ == "__main__": |
|
iface.launch() |
|
|