Spaces:
Running
Running
Commit
Β·
baf199d
1
Parent(s):
aab1d42
Update app.py
Browse files
app.py
CHANGED
@@ -62,9 +62,10 @@ def get_voices(language_id, dialect_id):
|
|
62 |
|
63 |
|
64 |
# λΉλμ€ λλ μ€λμ€ μ»¨ν
μΈ μμ±νλ ν¨μ.
|
65 |
-
def generate_contents():
|
|
|
|
|
66 |
url = API_HOME + END_GENERATE
|
67 |
-
#VOICE_ID = '61b8b45a4268666c126bb32b' # English
|
68 |
VOICE_ID = '65934ac2bc02ab1c006755fa' # Korean, Korea, Wolf Sea
|
69 |
|
70 |
payload = {
|
@@ -74,7 +75,8 @@ def generate_contents():
|
|
74 |
"content": user_content, # μ¬μ©μκ° μ
λ ₯ν ν
μ€νΈ
|
75 |
"voiceId": VOICE_ID
|
76 |
},
|
77 |
-
|
|
|
78 |
"settings": {
|
79 |
'aspectRatio': 'portrait', # 'portrait', 'square', 'horizontal'
|
80 |
'subtitle': {
|
@@ -86,7 +88,7 @@ def generate_contents():
|
|
86 |
},
|
87 |
"backgroundMusicKeywords": "happy, lofi, beats"
|
88 |
}
|
89 |
-
|
90 |
headers = set_header()
|
91 |
response = requests.request("POST", url, json=payload, headers=headers).json()
|
92 |
|
@@ -157,22 +159,17 @@ except Exception as e:
|
|
157 |
|
158 |
|
159 |
# Gradio μΈν°νμ΄μ€λ₯Ό μν ν¨μ
|
160 |
-
def gradio_generate_contents(brand_name):
|
161 |
-
|
162 |
-
brand = brand_name # μ¬μ©μ μ
λ ₯μΌλ‘ λΈλλλͺ
μ μ€μ
|
163 |
-
return generate_contents() # 컨ν
μΈ μμ± ν¨μ νΈμΆ
|
164 |
-
|
165 |
-
def gradio_generate_status(content_id):
|
166 |
-
return generate_status(content_id) # 컨ν
μΈ μν νμΈ ν¨μ νΈμΆ
|
167 |
|
168 |
-
# Gradio μΈν°νμ΄μ€
|
169 |
iface = gr.Interface(
|
170 |
fn=gradio_generate_contents, # 컨ν
μΈ μμ± ν¨μ
|
171 |
-
inputs=gr.inputs.Textbox(label="컨ν
μΈ
|
172 |
-
inputs=gr.inputs.Textbox(label="λΈλλ"),
|
173 |
outputs=gr.outputs.Textbox(label="컨ν
μΈ ID")
|
174 |
)
|
175 |
|
|
|
176 |
status_iface = gr.Interface(
|
177 |
fn=gradio_generate_status, # 컨ν
μΈ μν νμΈ ν¨μ
|
178 |
inputs=gr.inputs.Textbox(label="컨ν
μΈ ID"),
|
|
|
62 |
|
63 |
|
64 |
# λΉλμ€ λλ μ€λμ€ μ»¨ν
μΈ μμ±νλ ν¨μ.
|
65 |
+
def generate_contents(user_content, brand_name):
|
66 |
+
global brand
|
67 |
+
brand = brand_name # λΈλλλͺ
μ€μ
|
68 |
url = API_HOME + END_GENERATE
|
|
|
69 |
VOICE_ID = '65934ac2bc02ab1c006755fa' # Korean, Korea, Wolf Sea
|
70 |
|
71 |
payload = {
|
|
|
75 |
"content": user_content, # μ¬μ©μκ° μ
λ ₯ν ν
μ€νΈ
|
76 |
"voiceId": VOICE_ID
|
77 |
},
|
78 |
+
# ... λ€λ₯Έ μ¬λ€μ΄ νμνλ€λ©΄ μ¬κΈ°μ μΆκ° ...
|
79 |
+
],
|
80 |
"settings": {
|
81 |
'aspectRatio': 'portrait', # 'portrait', 'square', 'horizontal'
|
82 |
'subtitle': {
|
|
|
88 |
},
|
89 |
"backgroundMusicKeywords": "happy, lofi, beats"
|
90 |
}
|
91 |
+
|
92 |
headers = set_header()
|
93 |
response = requests.request("POST", url, json=payload, headers=headers).json()
|
94 |
|
|
|
159 |
|
160 |
|
161 |
# Gradio μΈν°νμ΄μ€λ₯Ό μν ν¨μ
|
162 |
+
def gradio_generate_contents(user_content, brand_name):
|
163 |
+
return generate_contents(user_content, brand_name) # λ μ
λ ₯ λͺ¨λ μ λ¬
|
|
|
|
|
|
|
|
|
|
|
164 |
|
165 |
+
# Gradio μΈν°νμ΄μ€ μμ
|
166 |
iface = gr.Interface(
|
167 |
fn=gradio_generate_contents, # 컨ν
μΈ μμ± ν¨μ
|
168 |
+
inputs=[gr.inputs.Textbox(label="컨ν
μΈ ν
μ€νΈ"), gr.inputs.Textbox(label="λΈλλλͺ
")],
|
|
|
169 |
outputs=gr.outputs.Textbox(label="컨ν
μΈ ID")
|
170 |
)
|
171 |
|
172 |
+
|
173 |
status_iface = gr.Interface(
|
174 |
fn=gradio_generate_status, # 컨ν
μΈ μν νμΈ ν¨μ
|
175 |
inputs=gr.inputs.Textbox(label="컨ν
μΈ ID"),
|