Spaces:
Build error
Build error
Commit
ยท
5206fbf
1
Parent(s):
ec9b0b0
Update app.py
Browse files
app.py
CHANGED
@@ -5,27 +5,34 @@ API_KEY = "ZZUIQ4OZASNRQ8B8WYHNW"
|
|
5 |
API_URL = "https://api.fliki.ai/v1/generate/text-to-image"
|
6 |
|
7 |
def generate_image(content, style):
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
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,
|
|
|
5 |
API_URL = "https://api.fliki.ai/v1/generate/text-to-image"
|
6 |
|
7 |
def generate_image(content, style):
|
8 |
+
headers = {
|
9 |
+
'Authorization': f'Bearer {API_KEY}',
|
10 |
+
'Content-Type': 'application/json',
|
11 |
+
}
|
12 |
+
json_data = {
|
13 |
+
'content': content,
|
14 |
+
'style': style,
|
15 |
+
}
|
16 |
+
response = requests.post(API_URL, headers=headers, json=json_data)
|
17 |
+
|
18 |
if response.status_code == 200:
|
19 |
+
return response.json()['url']
|
20 |
else:
|
21 |
raise Exception(f"์ค๋ฅ ๋ฐ์: {response.status_code}")
|
22 |
|
23 |
+
styles = [
|
24 |
+
"3d-model", "analog-film", "anime", "cinematic", "comic-book",
|
25 |
+
"digital-art", "enhance", "fantasy-art", "isometric", "line-art",
|
26 |
+
"low-poly", "modeling-compound", "neon-punk", "origami",
|
27 |
+
"photographic", "pixel-art", "tile-texture"
|
28 |
+
]
|
29 |
+
|
30 |
with gr.Blocks() as demo:
|
31 |
with gr.Row():
|
32 |
content_input = gr.Textbox(label="ํ
์คํธ ์
๋ ฅ")
|
33 |
+
style_input = gr.Dropdown(choices=styles, label="์คํ์ผ ์ ํ")
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
submit_button = gr.Button("์ด๋ฏธ์ง ์์ฑ")
|
35 |
+
output = gr.Image(label="์์ฑ๋ ์ด๋ฏธ์ง", type="pil")
|
36 |
|
37 |
submit_button.click(
|
38 |
generate_image,
|