Spaces:
Build error
Build error
Commit
ยท
ec9b0b0
1
Parent(s):
5e1e62f
Update app.py
Browse files
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
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
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'] #
|
19 |
else:
|
20 |
raise Exception(f"์ค๋ฅ ๋ฐ์: {response.status_code}")
|
21 |
|
22 |
with gr.Blocks() as demo:
|
23 |
with gr.Row():
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
submit_button.click(
|
30 |
-
|
31 |
-
inputs=[
|
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 |
|