seawolf2357 commited on
Commit
ec9b0b0
ยท
1 Parent(s): 5e1e62f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -18
app.py CHANGED
@@ -2,33 +2,34 @@ import gradio as gr
2
  import requests
3
 
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
 
 
2
  import requests
3
 
4
  API_KEY = "ZZUIQ4OZASNRQ8B8WYHNW"
5
+ API_URL = "https://api.fliki.ai/v1/generate/text-to-image"
6
 
7
+ def generate_image(content, style):
8
+ payload = {"content": content, "style": style}
9
+ headers = {"Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json"}
10
+
11
+ response = requests.post(API_URL, json=payload, headers=headers)
 
 
 
 
 
12
  if response.status_code == 200:
13
+ return response.json()['url'] # ์ด๋ฏธ์ง€ ๋‹ค์šด๋กœ๋“œ URL ๋ฐ˜ํ™˜
14
  else:
15
  raise Exception(f"์˜ค๋ฅ˜ ๋ฐœ์ƒ: {response.status_code}")
16
 
17
  with gr.Blocks() as demo:
18
  with gr.Row():
19
+ content_input = gr.Textbox(label="ํ…์ŠคํŠธ ์ž…๋ ฅ")
20
+ style_input = gr.Dropdown(
21
+ choices=["3d-model", "analog-film", "anime", "cinematic", "comic-book",
22
+ "digital-art", "enhance", "fantasy-art", "isometric", "line-art",
23
+ "low-poly", "modeling-compound", "neon-punk", "origami",
24
+ "photographic", "pixel-art", "tile-texture"],
25
+ label="์Šคํƒ€์ผ ์„ ํƒ"
26
+ )
27
+ submit_button = gr.Button("์ด๋ฏธ์ง€ ์ƒ์„ฑ")
28
+ output = gr.Image(label="์ƒ์„ฑ๋œ ์ด๋ฏธ์ง€")
29
 
30
  submit_button.click(
31
+ generate_image,
32
+ inputs=[content_input, style_input],
33
  outputs=output
34
  )
35