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