Spaces:
Sleeping
Sleeping
import gradio as gr | |
from gradio_client import Client | |
def get_text_ai(json_input): | |
space_text = json_input.get("space_text", "") | |
text = json_input.get("text", "") | |
key = json_input.get("key", "") | |
client = Client(space_text) | |
result = client.predict( | |
text=text, | |
key=key, | |
api_name="/predict") | |
return result | |
def get_url_speech(json_input,text): | |
space_speech = json_input.get("space_speech", "") | |
model = json_input.get("model", "") | |
speaking_rate=json_input.get("speaking_rate", "") | |
client = Client(space_speech) | |
result = client.predict( | |
text=text, | |
name_model=model, | |
speaking_rate=speaking_rate, | |
api_name="/predict") | |
return result | |
def greet(json_input): | |
res=get_text_ai(json_input) | |
if res: | |
return get_url_speech(json_input,res) | |
return '333' | |
demo = gr.Interface(fn=greet, inputs=gr.JSON(), outputs="text") | |
demo.launch() | |