shangrilar commited on
Commit
a4b0ab3
ยท
1 Parent(s): 5fcd0b6

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +53 -0
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
+