Update app.py
Browse files
app.py
CHANGED
|
@@ -304,34 +304,6 @@ def generate_combined_response(user_prompt):
|
|
| 304 |
print(type(final_image))
|
| 305 |
return final_image
|
| 306 |
|
| 307 |
-
|
| 308 |
-
|
| 309 |
-
def save_final_image(final_img):
|
| 310 |
-
# Pillow μ΄λ―Έμ§ -> base64 λ³ν
|
| 311 |
-
buffered = BytesIO()
|
| 312 |
-
final_img.save(buffered, format="PNG")
|
| 313 |
-
img_data = buffered.getvalue()
|
| 314 |
-
b64_img = base64.b64encode(img_data).decode()
|
| 315 |
-
|
| 316 |
-
# μλλ€μ΄λ‘λλ₯Ό μλνλ JS + iOS λ±μμ λ§ν κ²½μ° μ§μ ν΄λ¦ν μ μλ λ§ν¬λ₯Ό μ 곡
|
| 317 |
-
# data URI μ€ν€λ§λ₯Ό μ¬μ©: "data:image/png;base64,{...}"
|
| 318 |
-
download_html = f"""
|
| 319 |
-
<div style="text-align: center;">
|
| 320 |
-
<a id="download_link"
|
| 321 |
-
href="data:image/png;base64,{b64_img}"
|
| 322 |
-
download="teenieping.png"
|
| 323 |
-
style="text-decoration: none; font-size:18px; color:blue;">
|
| 324 |
-
[ λ€μ΄λ‘λκ° μλ κ²½μ° μ¬κΈ°λ₯Ό λλ¬μ£ΌμΈμ ]
|
| 325 |
-
</a>
|
| 326 |
-
<script>
|
| 327 |
-
// PCλ μλλ‘μ΄λμμ μλ λ€μ΄λ‘λκ° λ μλ μμΌλ,
|
| 328 |
-
// iOS μ¬ν리μμ μλ λ€μ΄λ‘λκ° λ§ν μ μμ΅λλ€.
|
| 329 |
-
document.getElementById('download_link').click();
|
| 330 |
-
</script>
|
| 331 |
-
</div>
|
| 332 |
-
"""
|
| 333 |
-
return download_html
|
| 334 |
-
|
| 335 |
with gr.Blocks(css=css_code) as interface:
|
| 336 |
gr.Markdown("<h1 style='font-size:30px;'>μλ‘μ΄ ν°λνμ΄ λνλ¬λ€!</h1>")
|
| 337 |
gr.Markdown("ννΈλ‘μ¦ λ² μ΄μ»€λ¦¬μ λ€μ΄μ λΉμ .")
|
|
@@ -351,6 +323,15 @@ with gr.Blocks(css=css_code) as interface:
|
|
| 351 |
btn.click(fn=generate_combined_response, inputs=inp, outputs=out)
|
| 352 |
#btn2.click(fn=save_final_image, inputs=out, outputs=output_html)
|
| 353 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 354 |
# μ± μ€ν
|
| 355 |
if __name__ == "__main__":
|
| 356 |
interface.launch(server_name="0.0.0.0", server_port=int(os.getenv("PORT", 7860)), share=True)
|
|
|
|
| 304 |
print(type(final_image))
|
| 305 |
return final_image
|
| 306 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 307 |
with gr.Blocks(css=css_code) as interface:
|
| 308 |
gr.Markdown("<h1 style='font-size:30px;'>μλ‘μ΄ ν°λνμ΄ λνλ¬λ€!</h1>")
|
| 309 |
gr.Markdown("ννΈλ‘μ¦ λ² μ΄μ»€λ¦¬μ λ€μ΄μ λΉμ .")
|
|
|
|
| 323 |
btn.click(fn=generate_combined_response, inputs=inp, outputs=out)
|
| 324 |
#btn2.click(fn=save_final_image, inputs=out, outputs=output_html)
|
| 325 |
|
| 326 |
+
gr.Markdown(
|
| 327 |
+
"""
|
| 328 |
+
---
|
| 329 |
+
### Contact Info
|
| 330 |
+
- **Instagram**: [@temuping](https://instagram.com/temuping)
|
| 331 |
+
- **Mail**: [temooping@gmail.com](mailto:temooping@gmail.com)
|
| 332 |
+
"""
|
| 333 |
+
)
|
| 334 |
+
|
| 335 |
# μ± μ€ν
|
| 336 |
if __name__ == "__main__":
|
| 337 |
interface.launch(server_name="0.0.0.0", server_port=int(os.getenv("PORT", 7860)), share=True)
|