Spaces:
Paused
Paused
shangrilar
commited on
Commit
ยท
a4b0ab3
1
Parent(s):
5fcd0b6
Upload app.py
Browse files
app.py
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# ---
|
2 |
+
# jupyter:
|
3 |
+
# jupytext:
|
4 |
+
# formats: ipynb,py:light
|
5 |
+
# text_representation:
|
6 |
+
# extension: .py
|
7 |
+
# format_name: light
|
8 |
+
# format_version: '1.5'
|
9 |
+
# jupytext_version: 1.14.1
|
10 |
+
# kernelspec:
|
11 |
+
# display_name: Python 3 (ipykernel)
|
12 |
+
# language: python
|
13 |
+
# name: python3
|
14 |
+
# ---
|
15 |
+
|
16 |
+
# +
|
17 |
+
import gradio as gr
|
18 |
+
import requests
|
19 |
+
import json
|
20 |
+
from utils import get_story, get_voice_filename, get_music
|
21 |
+
|
22 |
+
with gr.Blocks() as performance:
|
23 |
+
with gr.Tab("Story Generation"):
|
24 |
+
chatbot = gr.Chatbot(label='GPT4', elem_id="chatbot")
|
25 |
+
input_text = gr.Textbox(lines=2, label="์์ ๋ฌธ์ฅ")
|
26 |
+
input_number = gr.Number(label='๋ฌธ์ฅ์', value=20)
|
27 |
+
state = gr.State([])
|
28 |
+
with gr.Row():
|
29 |
+
with gr.Column():
|
30 |
+
b1 = gr.Button().style(full_width=True)
|
31 |
+
b1.click(get_story, [input_text, input_number, chatbot, state], [chatbot, state])
|
32 |
+
|
33 |
+
with gr.Tab("Voice Generation"):
|
34 |
+
input_text = gr.Textbox(lines=10, label="๋ฌธ์ฅ")
|
35 |
+
input_gender = gr.Radio(choices=["๋จ์ฑ", "์ฌ์ฑ"], value="๋จ์ฑ", label="์ฑ๋ณ")
|
36 |
+
input_age = gr.Radio(choices=["์ด๋ฆฐ์ด", "์ฒญ์๋
", "์ฒญ๋
", "์ค๋
"], value='์ฒญ๋
', label="์ฐ๋ น๋")
|
37 |
+
with gr.Row():
|
38 |
+
with gr.Column():
|
39 |
+
b2 = gr.Button().style(full_width=True)
|
40 |
+
b2.click(get_voice_filename, [input_text, input_gender, input_age], [gr.Audio(label="๊ฒฐ๊ณผ ์์ฑ ํ์ผ", type="filepath")])
|
41 |
+
|
42 |
+
with gr.Tab("Music Generation"):
|
43 |
+
input_text = gr.Textbox(lines=10, label="๋ฌธ์ฅ")
|
44 |
+
input_duration = gr.Number(label="์์
์๊ฐ(s)", value=30)
|
45 |
+
with gr.Row():
|
46 |
+
with gr.Column():
|
47 |
+
b3 = gr.Button().style(full_width=True)
|
48 |
+
b3.click(get_music, [input_text, input_duration], gr.Audio(label="๊ฒฐ๊ณผ ์์
ํ์ผ", type='filepath'))
|
49 |
+
|
50 |
+
performance.queue(max_size=5).launch()
|
51 |
+
# -
|
52 |
+
|
53 |
+
|