apisforft / app.py
laxsvips's picture
Fixes for audio API addition
ce0ee22
raw
history blame
1.16 kB
import generate_text
import gradio
import audio
def gentext():
result = generate_text.call_llm()
return result
def genaudio():
result = audio.generate_voice(text, voice_name, model_name)
generate_text_gr = gradio.Interface(
fn=gentext,
inputs=None,
outputs="text",
title="Generate Character and Dialogue Text",
description="An API to generate text"
)
out_audio = gradio.Audio(
label="Generated Voice",
type="numpy",
elem_id="out_audio"
)
input_text = gradio.Textbox(
label="Input Text (250 characters max)",
lines=2,
value="Hahaha OHH MY GOD! This is SOOO funny, I-I am Eleven a text-to-speech system!",
elem_id="input_text"
)
input_voice = "Arnold"
input_model = "eleven_monolingual_v1"
inputs = [input_text, input_voice, input_model]
outputs = [out_audio]
generate_audio_gr = gradio.Interface(
fn=genaudio,
inputs=inputs,
outputs=outputs,
title="Generate Audio",
description="An API to generate audio"
)
genesis_app = gradio.TabbedInterface([generate_text_gr, generate_audio_gr], ["Generate Character and Dialogue Text", "Generate Audio"])
genesis_app.launch()