File size: 498 Bytes
34eb043
6c7a215
34eb043
26349dc
 
34eb043
6c7a215
 
26349dc
 
 
6c7a215
26349dc
 
34eb043
26349dc
 
 
6c7a215
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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:
        print(f"Client: {client}")
        print(f"Requesting prediction for: {text}")
    result = client.predict(
		#"Hello World",	# str  in 'text' Textbox component
        text,
		api_name="/predict"
    )
    if DEBUG_MODE:
        print(f"Prediction result: {result}")
    return result


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