|
import generate_text |
|
import gradio |
|
import audio |
|
|
|
def gentext(): |
|
result = generate_text.call_llm() |
|
return result |
|
|
|
def genaudio(text): |
|
result = audio.generate_voice(text) |
|
return result |
|
|
|
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", |
|
lines=2, |
|
value="There are 7 days in a week", |
|
elem_id="input_text" |
|
) |
|
|
|
|
|
|
|
|
|
inputs = [input_text] |
|
outputs = [out_audio] |
|
generate_audio_gr = gradio.Interface( |
|
fn=genaudio, |
|
inputs=inputs, |
|
outputs="text", |
|
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() |