Spaces:
Sleeping
Sleeping
File size: 849 Bytes
6c7a215 2c2797b 34eb043 903b6b9 749138f 26349dc 749138f 903b6b9 c0b5a98 749138f 903b6b9 c0b5a98 903b6b9 c0b5a98 903b6b9 c0b5a98 e8f20a0 903b6b9 e8f20a0 |
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 30 31 32 33 34 35 36 |
import gradio as gr
from gradio_client import Client
DEBUG_MODE = True
def update(name):
#return f"Welcome to Gradio, {name}!"
return {"name": name}
def send_request(text):
client = Client("Nuno-Tome/API_demo_server")
result = client.predict(
text,
api_name="/predict"
)
return result
with gr.Blocks() as demo:
with gr.Row():
gr.Markdown("Start typing below and then click **Run** to see the output.")
#gr.DuplicateButton()
with gr.Row():
with gr.Column():
gr.Markdown("Type your message:")
inp = gr.Textbox(placeholder="What is your name?")
with gr.Column():
out = gr.JSON()
btn = gr.Button("Send request to server")
btn.click(fn=send_request, inputs=inp, outputs=out)
demo.launch(share=True) |