File size: 601 Bytes
34eb043
6c7a215
34eb043
26349dc
 
34eb043
6c7a215
 
26349dc
721f108
ca2b37a
 
721f108
 
436113b
721f108
 
26349dc
ca2b37a
26349dc
6c7a215
 
 
436113b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from gradio_client import Client
import gradio as gr

DEBUG_MODE = True

client = Client("Nuno-Tome/API_demo_server")

def request(text):
    if DEBUG_MODE:
        result = "Hello World"
        gr.Markdown("client:" + str(client))
        gr.Markdown(f"## Requesting prediction for: {text}")
    #result = client.echo(
	#	"Hello World",	# str  in 'text' Textbox component
        #text,
	#	api_name="/echo"
    #)
    if DEBUG_MODE:
        gr.Markdown(f"## Prediction result: {result}")
        print(f"Prediction result: {result}")
    return result


io = gr.Interface(request, "textbox", "json")