Nuno-Tome commited on
Commit
9ad6428
1 Parent(s): b106dfa
Files changed (1) hide show
  1. app.py +12 -5
app.py CHANGED
@@ -34,8 +34,8 @@ def get_bmc_markdown():
34
 
35
 
36
  def send_request(text):
37
- client = Client("Nuno-Tome/API_demo_server")
38
- result = client.predict(
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.Markdown("**Type your message:**")
53
- inp = gr.TextArea(placeholder="What is your name?")
 
 
 
 
 
 
 
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=inp, outputs=out)
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)