Nuno-Tome commited on
Commit
749138f
1 Parent(s): 2c2797b
Files changed (3) hide show
  1. app copy.py +1 -5
  2. app.py +13 -3
  3. flagged/log.csv +2 -0
app copy.py CHANGED
@@ -10,11 +10,7 @@ def request(text):
10
  result = "Hello World"
11
  # gr.Markdown("client:" + str(client))
12
  # gr.Markdown(f"## Requesting prediction for: {text}")
13
- #result = client.echo(
14
- # "Hello World", # str in 'text' Textbox component
15
- #text,
16
- # api_name="/echo"
17
- #)
18
  #if DEBUG_MODE:
19
  # gr.Markdown(f"## Prediction result: {result}")
20
  # print(f"Prediction result: {result}")
 
10
  result = "Hello World"
11
  # gr.Markdown("client:" + str(client))
12
  # gr.Markdown(f"## Requesting prediction for: {text}")
13
+ result = client.echo(text, api_name="/echo")
 
 
 
 
14
  #if DEBUG_MODE:
15
  # gr.Markdown(f"## Prediction result: {result}")
16
  # print(f"Prediction result: {result}")
app.py CHANGED
@@ -1,9 +1,19 @@
1
  import gradio as gr
2
  from gradio_client import Client
3
 
4
- def greet(name):
5
- return "Hello " + name + "!"
6
 
7
- demo = gr.Interface(fn=greet, inputs="textbox", outputs="textbox")
 
 
 
 
 
 
 
 
 
 
8
 
9
  demo.launch(share=True)
 
1
  import gradio as gr
2
  from gradio_client import Client
3
 
4
+ client = Client("Nuno-Tome/API_demo_server")
5
+ DEBUG_MODE = True
6
 
7
+
8
+ def request(text):
9
+ #result = client.echo(text, api_name="/predict")
10
+ #return result
11
+ result = client.predict(
12
+ "Hello!!", # str in 'text' Textbox component
13
+ api_name="/predict"
14
+ )
15
+ return result
16
+
17
+ demo = gr.Interface(fn=request, inputs="textbox", outputs="textbox")
18
 
19
  demo.launch(share=True)
flagged/log.csv ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ text,output,flag,username,timestamp
2
+ ada,,,,2024-03-09 13:25:51.530696