Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
# Hugging Face ๋ชจ๋ธ ํ์ดํ๋ผ์ธ ๋ก๋
|
5 |
+
model = pipeline('image-generation', model='CompVis/dalle-mini')
|
6 |
+
|
7 |
+
def generate_image(prompt):
|
8 |
+
response = model(prompt, return_tensors="pt")
|
9 |
+
return response.images[0]
|
10 |
+
|
11 |
+
# Gradio ์ธํฐํ์ด์ค ์์ฑ
|
12 |
+
iface = gr.Interface(
|
13 |
+
fn=generate_image,
|
14 |
+
inputs=gr.inputs.Textbox(lines=2, placeholder="์ฌ๊ธฐ์ ํ
์คํธ๋ฅผ ์
๋ ฅํ์ธ์..."),
|
15 |
+
outputs=gr.outputs.Image(type="pil"),
|
16 |
+
title="ํ
์คํธ๋ฅผ ์ด๋ฏธ์ง๋ก ๋ณํ",
|
17 |
+
description="ํ
์คํธ๋ฅผ ์
๋ ฅํ๋ฉด ์ด๋ฏธ์ง๋ฅผ ์์ฑํฉ๋๋ค."
|
18 |
+
)
|
19 |
+
|
20 |
+
# ์ธํฐํ์ด์ค ์คํ
|
21 |
+
iface.launch()
|