Spaces:
Build error
Build error
Commit
Β·
5e1e62f
1
Parent(s):
9684c3a
Update app.py
Browse files
app.py
CHANGED
@@ -4,32 +4,31 @@ import requests
|
|
4 |
API_KEY = "ZZUIQ4OZASNRQ8B8WYHNW"
|
5 |
API_URL = "https://api.fliki.ai/v1"
|
6 |
|
7 |
-
def generate_content(
|
8 |
url = f"{API_URL}/generate"
|
9 |
payload = {
|
10 |
"format": format,
|
11 |
-
"scenes": [{"content":
|
12 |
-
# μΆκ°
|
13 |
}
|
14 |
headers = {"Authorization": f"Bearer {API_KEY}"}
|
15 |
-
response = requests.post(url, json=payload, headers=headers)
|
16 |
|
|
|
17 |
if response.status_code == 200:
|
18 |
-
return response.json()['url']
|
19 |
else:
|
20 |
raise Exception(f"μ€λ₯ λ°μ: {response.status_code}")
|
21 |
|
22 |
with gr.Blocks() as demo:
|
23 |
with gr.Row():
|
24 |
-
|
25 |
-
|
26 |
-
voice_id_input = gr.Textbox(label="μμ± ID μ
λ ₯")
|
27 |
submit_button = gr.Button("μμ±")
|
28 |
output = gr.Video(label="μμ±λ μ½ν
μΈ ")
|
29 |
|
30 |
submit_button.click(
|
31 |
generate_content,
|
32 |
-
inputs=[
|
33 |
outputs=output
|
34 |
)
|
35 |
|
|
|
4 |
API_KEY = "ZZUIQ4OZASNRQ8B8WYHNW"
|
5 |
API_URL = "https://api.fliki.ai/v1"
|
6 |
|
7 |
+
def generate_content(text, format):
|
8 |
url = f"{API_URL}/generate"
|
9 |
payload = {
|
10 |
"format": format,
|
11 |
+
"scenes": [{"content": text}],
|
12 |
+
# μΆκ° μ€μ μ΄ νμνλ©΄ μ¬κΈ°μ μΆκ°
|
13 |
}
|
14 |
headers = {"Authorization": f"Bearer {API_KEY}"}
|
|
|
15 |
|
16 |
+
response = requests.post(url, json=payload, headers=headers)
|
17 |
if response.status_code == 200:
|
18 |
+
return response.json()['url'] # μλ΅μμ URL μΆμΆ
|
19 |
else:
|
20 |
raise Exception(f"μ€λ₯ λ°μ: {response.status_code}")
|
21 |
|
22 |
with gr.Blocks() as demo:
|
23 |
with gr.Row():
|
24 |
+
text_input = gr.Textbox(label="ν
μ€νΈ μ
λ ₯")
|
25 |
+
format_input = gr.Dropdown(choices=["text-to-speech", "text-to-video"], label="ν¬λ§· μ ν")
|
|
|
26 |
submit_button = gr.Button("μμ±")
|
27 |
output = gr.Video(label="μμ±λ μ½ν
μΈ ")
|
28 |
|
29 |
submit_button.click(
|
30 |
generate_content,
|
31 |
+
inputs=[text_input, format_input],
|
32 |
outputs=output
|
33 |
)
|
34 |
|