Spaces:
Sleeping
Sleeping
Merge branch 'beta_feature/json_beautify'
Browse files- app copy.py +20 -0
- app.py +14 -4
- flagged/log.csv +2 -0
- requirements.txt +2 -1
app copy.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from gradio_client import Client
|
| 2 |
+
import gradio as gr
|
| 3 |
+
|
| 4 |
+
DEBUG_MODE = True
|
| 5 |
+
|
| 6 |
+
client = Client("Nuno-Tome/API_demo_server")
|
| 7 |
+
|
| 8 |
+
def request(text):
|
| 9 |
+
#if DEBUG_MODE:
|
| 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}")
|
| 17 |
+
return result
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
io = gr.Interface(request, "textbox", "json")
|
app.py
CHANGED
|
@@ -1,8 +1,18 @@
|
|
|
|
|
| 1 |
from gradio_client import Client
|
| 2 |
|
| 3 |
client = Client("Nuno-Tome/API_demo_server")
|
| 4 |
-
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
api_name="/predict"
|
| 7 |
-
)
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
|
| 10 |
+
result = client.predict(
|
| 11 |
+
text,
|
| 12 |
api_name="/predict"
|
| 13 |
+
)
|
| 14 |
+
return result
|
| 15 |
+
|
| 16 |
+
demo = gr.Interface(fn=request, inputs="textbox", outputs="json")
|
| 17 |
+
|
| 18 |
+
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
|
requirements.txt
CHANGED
|
@@ -1 +1,2 @@
|
|
| 1 |
-
gradio_client
|
|
|
|
|
|
| 1 |
+
gradio_client
|
| 2 |
+
gradio
|