Spaces:
Sleeping
Sleeping
beautify
Browse files
app.py
CHANGED
|
@@ -34,8 +34,8 @@ def get_bmc_markdown():
|
|
| 34 |
|
| 35 |
|
| 36 |
def send_request(text):
|
| 37 |
-
|
| 38 |
-
result =
|
| 39 |
text,
|
| 40 |
api_name="/predict"
|
| 41 |
)
|
|
@@ -49,12 +49,19 @@ with gr.Blocks() as demo:
|
|
| 49 |
|
| 50 |
with gr.Row():
|
| 51 |
with gr.Column():
|
| 52 |
-
gr.
|
| 53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
with gr.Column():
|
| 55 |
gr.Markdown("**This is your gradio api request response:**")
|
| 56 |
out = gr.JSON()
|
| 57 |
btn = gr.Button("Send request to server")
|
| 58 |
-
btn.click(fn=send_request, inputs=
|
| 59 |
|
| 60 |
demo.launch(share=True)
|
|
|
|
| 34 |
|
| 35 |
|
| 36 |
def send_request(text):
|
| 37 |
+
server = Client("Nuno-Tome/API_demo_server")
|
| 38 |
+
result = server.predict(
|
| 39 |
text,
|
| 40 |
api_name="/predict"
|
| 41 |
)
|
|
|
|
| 49 |
|
| 50 |
with gr.Row():
|
| 51 |
with gr.Column():
|
| 52 |
+
input_text = gr.TextArea(
|
| 53 |
+
placeholder="What is your name?",
|
| 54 |
+
label= "**Type your message:**"
|
| 55 |
+
)
|
| 56 |
+
input_server = gr.Textbox(
|
| 57 |
+
lines = 1,
|
| 58 |
+
placeholder = "Server URL",
|
| 59 |
+
label= "**Type the server to call:**"
|
| 60 |
+
)
|
| 61 |
with gr.Column():
|
| 62 |
gr.Markdown("**This is your gradio api request response:**")
|
| 63 |
out = gr.JSON()
|
| 64 |
btn = gr.Button("Send request to server")
|
| 65 |
+
btn.click(fn=send_request, inputs=input_text, outputs=out)
|
| 66 |
|
| 67 |
demo.launch(share=True)
|