Spaces:
Paused
Paused
import gradio as gr | |
import requests | |
import json | |
from utils import get_story, get_voice_filename, get_musicgen_music, get_mubert_music | |
with gr.Blocks() as performance: | |
with gr.Tab("Story Generation"): | |
chatbot = gr.Chatbot(label='GPT4', elem_id="chatbot") | |
input_text = gr.Textbox(lines=2, label="์์ ๋ฌธ์ฅ") | |
input_number = gr.Number(label='๋ฌธ์ฅ์', value=20) | |
state = gr.State([]) | |
with gr.Row(): | |
with gr.Column(): | |
b1 = gr.Button().style(full_width=True) | |
b1.click(get_story, [input_text, input_number, chatbot, state], [chatbot, state]) | |
with gr.Tab("Voice Generation"): | |
input_text = gr.Textbox(lines=10, label="๋ฌธ์ฅ") | |
input_gender = gr.Radio(choices=["๋จ์ฑ", "์ฌ์ฑ"], value="๋จ์ฑ", label="์ฑ๋ณ") | |
input_age = gr.Radio(choices=["์ฒญ๋ ", "์ค๋ "], value='์ฒญ๋ ', label="์ฐ๋ น๋") | |
input_speed = gr.Slider(minimum=0, maximum=5, step=1, value=1, label="์๋") | |
input_pitch = gr.Slider(minimum=0, maximum=5, step=1, value=1, label="์์") | |
input_alpha = gr.Slider(minimum=-5, maximum=0, step=1, value=-1, label="๋๋ฎ์ด") | |
with gr.Row(): | |
with gr.Column(): | |
b2 = gr.Button().style(full_width=True) | |
b2.click(get_voice_filename, [input_text, input_gender, input_age, input_speed, input_pitch, input_alpha], [gr.Audio(label="๊ฒฐ๊ณผ ์์ฑ ํ์ผ", type="filepath")]) | |
with gr.Tab("Music Generation - MusicGen"): | |
input_text = gr.Textbox(lines=10, label="๋ฌธ์ฅ") | |
input_duration = gr.Number(label="์์ ์๊ฐ(s)", value=30) | |
with gr.Row(): | |
with gr.Column(): | |
b3 = gr.Button().style(full_width=True) | |
b3.click(get_musicgen_music, [input_text, input_duration], gr.Audio(label="๊ฒฐ๊ณผ ์์ ํ์ผ", type='filepath')) | |
# with gr.Tab("Music Generation - Mubert"): | |
# input_text = gr.Textbox(lines=10, label="๋ฌธ์ฅ") | |
# input_duration = gr.Number(label="์์ ์๊ฐ(s)", value=30) | |
# with gr.Row(): | |
# with gr.Column(): | |
# b3 = gr.Button().style(full_width=True) | |
# b3.click(get_mubert_music, [input_text, input_duration], gr.Audio(label="๊ฒฐ๊ณผ ์์ ํ์ผ", type='filepath')) | |
performance.queue().launch() |