File size: 970 Bytes
aa95dd5
bc18a34
 
993c6c8
 
2e459e2
 
 
993c6c8
2e459e2
993c6c8
bc18a34
2e459e2
7d0efdb
2e459e2
699ea5d
2796462
993c6c8
2e459e2
 
993c6c8
2e459e2
2796462
 
2e459e2
 
 
2796462
bc18a34
2e459e2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import gradio as gr
import requests

API_KEY = "ZZUIQ4OZASNRQ8B8WYHNW"

def generate_content(text, content_type):
    url = f"https://api.fliki.ai/v1/generate/{content_type}"
    payload = {"text": text}
    headers = {"Authorization": f"Bearer {API_KEY}"}

    response = requests.post(url, json=payload, headers=headers)
    if response.status_code == 200:
        return response.json()['url']  # λΉ„λ””μ˜€ λ˜λŠ” μ˜€λ””μ˜€ URL λ°˜ν™˜
    else:
        raise Exception(f"였λ₯˜ λ°œμƒ: {response.status_code}")

with gr.Blocks() as demo:
    with gr.Row():
        text_input = gr.Textbox(label="ν…μŠ€νŠΈ μž…λ ₯")
        content_type_input = gr.Dropdown(choices=["text-to-speech", "text-to-video"], label="μ½˜ν…μΈ  μœ ν˜•")
        submit_button = gr.Button("생성")
    output = gr.Video(label="μƒμ„±λœ μ½˜ν…μΈ ")

    submit_button.click(
        generate_content,
        inputs=[text_input, content_type_input],
        outputs=output
    )

demo.launch()