Spaces:
Build error
Build error
File size: 1,522 Bytes
aa95dd5 bc18a34 bd532eb bc18a34 993c6c8 ec9b0b0 5206fbf bd532eb bc18a34 bd532eb 7d0efdb bd532eb 5206fbf 2796462 993c6c8 ec9b0b0 bd532eb ec9b0b0 5206fbf 2796462 ec9b0b0 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 32 33 34 35 36 37 38 39 40 41 42 43 44 |
import gradio as gr
import requests
from PIL import Image
import io
API_KEY = "ZZUIQ4OZASNRQ8B8WYHNW"
def generate_image(content, style):
headers = {
'Authorization': f'Bearer {API_KEY}',
}
json_data = {
'content': content,
'style': style,
}
response = requests.post('https://api.fliki.ai/v1/generate/text-to-image', headers=headers, json=json_data)
if response.status_code == 200:
image_url = response.json()['url']
image_response = requests.get(image_url)
image = Image.open(io.BytesIO(image_response.content))
return image
else:
raise Exception(f"์ค๋ฅ ๋ฐ์: {response.text}")
with gr.Blocks() as demo:
with gr.Row():
content_input = gr.Textbox(label="ํ
์คํธ ์
๋ ฅ")
style_input = gr.Dropdown(choices=['3d-model', 'analog-film', 'anime', 'cinematic',
'comic-book', 'digital-art', 'enhance', 'fantasy-art',
'isometric', 'line-art', 'low-poly', 'modeling-compound',
'neon-punk', 'origami', 'photographic', 'pixel-art',
'tile-texture'], label="์คํ์ผ ์ ํ")
submit_button = gr.Button("์ด๋ฏธ์ง ์์ฑ")
output = gr.Image(label="์์ฑ๋ ์ด๋ฏธ์ง", type="pil")
submit_button.click(
generate_image,
inputs=[content_input, style_input],
outputs=output
)
demo.launch()
|