Update app.py
Browse files
app.py
CHANGED
@@ -206,35 +206,19 @@ def process_and_show_prompt(image1, image2, image3, prompt):
|
|
206 |
logger.exception("์ฒ๋ฆฌ ์ค ์ค๋ฅ ๋ฐ์:")
|
207 |
return None, f"์ค๋ฅ ๋ฐ์: {str(e)}", prompt
|
208 |
|
209 |
-
# ์์
|
210 |
-
|
211 |
-
"""์์ 1: ์ด๋ฏธ์ง ๋ณ๊ฒฝ ์์ """
|
212 |
-
input_path = os.path.join("down", "1_in-1.png")
|
213 |
-
output_path = os.path.join("down", "1_out-1.webp")
|
214 |
-
try:
|
215 |
-
input_img = Image.open(input_path)
|
216 |
-
except Exception as e:
|
217 |
-
return None, f"์
๋ ฅ ์ด๋ฏธ์ง ์ด๊ธฐ ์ค๋ฅ: {str(e)}", ""
|
218 |
-
prompt = "#1 ์ด๋ฏธ์ง์ [์ฒญ์ ์์ด๋ ๊ณ ๋ฅผ ๊ฒ์ ๊ณ ๋๋ ๊ณ ]์ผ๋ก ๋ณ๊ฒฝํ๋ผ."
|
219 |
-
result_img, status, final_prompt = process_and_show_prompt(input_img, None, None, prompt)
|
220 |
-
if result_img is not None:
|
221 |
-
result_img.save(output_path, "WEBP")
|
222 |
-
return result_img, status, final_prompt
|
223 |
|
224 |
-
|
225 |
-
"""
|
226 |
-
|
227 |
-
|
228 |
-
try:
|
229 |
-
input_img = Image.open(input_path)
|
230 |
-
except Exception as e:
|
231 |
-
return None, f"์
๋ ฅ ์ด๋ฏธ์ง ์ด๊ธฐ ์ค๋ฅ: {str(e)}", ""
|
232 |
-
prompt = "#1 ์ด๋ฏธ์ง์ [์ค๊ตญ์ด๋ฅผ ๋ชจ๋]๋ฅผ ์ ๊ฑฐํ๋ผ."
|
233 |
-
result_img, status, final_prompt = process_and_show_prompt(input_img, None, None, prompt)
|
234 |
-
if result_img is not None:
|
235 |
-
result_img.save(output_path, "WEBP")
|
236 |
-
return result_img, status, final_prompt
|
237 |
|
|
|
|
|
|
|
|
|
|
|
238 |
|
239 |
# ๊ธฐ์กด Gradio ์ธํฐํ์ด์ค ๊ตฌ์ฑ (์์ ์ ์ฉ ์ธ ๋ค๋ฅธ ์ฝ๋๋ ๊ทธ๋๋ก ์ ์ง)
|
240 |
with gr.Blocks() as demo:
|
@@ -276,14 +260,8 @@ with gr.Blocks() as demo:
|
|
276 |
gr.Markdown("## Try these examples", elem_classes="gr-examples-header")
|
277 |
|
278 |
examples = [
|
279 |
-
["
|
280 |
-
["
|
281 |
-
["data/3.webp", 'change text to "Make it "', ""],
|
282 |
-
["data/1.jpg", "add joker style only on face", ""],
|
283 |
-
["data/1777043.jpg", "add joker style only on face", ""],
|
284 |
-
["data/2807615.jpg", "add lipstick on lip only", ""],
|
285 |
-
["data/76860.jpg", "add lipstick on lip only", ""],
|
286 |
-
["data/2807615.jpg", "make it happy looking face only", ""],
|
287 |
]
|
288 |
|
289 |
gr.Examples(
|
|
|
206 |
logger.exception("์ฒ๋ฆฌ ์ค ์ค๋ฅ ๋ฐ์:")
|
207 |
return None, f"์ค๋ฅ ๋ฐ์: {str(e)}", prompt
|
208 |
|
209 |
+
# ์์ ์ ์ฉ ๋ถ๋ถ (์ฐธ์กฐ ์ฝ๋ ์ ์ฉ)
|
210 |
+
gr.Markdown("## Try these examples", elem_classes="gr-examples-header")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
211 |
|
212 |
+
examples = [
|
213 |
+
["down/1_in-1.png", "#1 ์ด๋ฏธ์ง์ [์ฒญ์ ์์ด๋ ๊ณ ๋ฅผ ๊ฒ์ ๊ณ ๋๋ ๊ณ ]์ผ๋ก ๋ณ๊ฒฝํ๋ผ.", ""],
|
214 |
+
["down/2_in-1.png", "#1 ์ด๋ฏธ์ง์ [์ค๊ตญ์ด๋ฅผ ๋ชจ๋]๋ฅผ ์ ๊ฑฐํ๋ผ.", ""],
|
215 |
+
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
216 |
|
217 |
+
gr.Examples(
|
218 |
+
examples=examples,
|
219 |
+
inputs=[image_input, prompt_input],
|
220 |
+
elem_id="examples-grid"
|
221 |
+
)
|
222 |
|
223 |
# ๊ธฐ์กด Gradio ์ธํฐํ์ด์ค ๊ตฌ์ฑ (์์ ์ ์ฉ ์ธ ๋ค๋ฅธ ์ฝ๋๋ ๊ทธ๋๋ก ์ ์ง)
|
224 |
with gr.Blocks() as demo:
|
|
|
260 |
gr.Markdown("## Try these examples", elem_classes="gr-examples-header")
|
261 |
|
262 |
examples = [
|
263 |
+
["down/1_in-1.png", "#1 ์ด๋ฏธ์ง์ [์ฒญ์ ์์ด๋ ๊ณ ๋ฅผ ๊ฒ์ ๊ณ ๋๋ ๊ณ ]์ผ๋ก ๋ณ๊ฒฝํ๋ผ.", ""],
|
264 |
+
["down/2_in-1.png", "#1 ์ด๋ฏธ์ง์ [์ค๊ตญ์ด๋ฅผ ๋ชจ๋]๋ฅผ ์ ๊ฑฐํ๋ผ.", ""],
|
|
|
|
|
|
|
|
|
|
|
|
|
265 |
]
|
266 |
|
267 |
gr.Examples(
|