Spaces:
Sleeping
Sleeping
no message
Browse files- app copy.py +24 -0
- app.py +5 -21
app copy.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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(
|
| 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}")
|
| 21 |
+
return result
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
io = gr.Interface(request, "textbox", "json")
|
app.py
CHANGED
|
@@ -1,24 +1,8 @@
|
|
| 1 |
-
from gradio_client import Client
|
| 2 |
import gradio as gr
|
| 3 |
|
| 4 |
-
|
|
|
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 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(
|
| 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}")
|
| 21 |
-
return result
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
io = gr.Interface(request, "textbox", "json")
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
+
def greet(name):
|
| 4 |
+
return "Hello " + name + "!"
|
| 5 |
|
| 6 |
+
demo = gr.Interface(fn=greet, inputs="textbox", outputs="textbox")
|
| 7 |
+
|
| 8 |
+
demo.launch(share=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|