kimpudding commited on
Commit
ad4d1d5
ยท
verified ยท
1 Parent(s): 5e7154f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -2
app.py CHANGED
@@ -293,8 +293,20 @@ def generate_combined_response(user_prompt):
293
  upload_file_to_drive(drive, DRIVE_FOLDER_ID, jpg_filename_local, jpg_filename_local)
294
 
295
 
296
- return final_image
297
-
 
 
 
 
 
 
 
 
 
 
 
 
298
 
299
  with gr.Blocks(css=css_code) as interface:
300
  gr.Markdown("<h1 style='font-size:30px;'>์ƒˆ๋กœ์šด ํ‹ฐ๋‹ˆํ•‘์ด ๋‚˜ํƒ€๋‚ฌ๋‹ค!</h1>")
 
293
  upload_file_to_drive(drive, DRIVE_FOLDER_ID, jpg_filename_local, jpg_filename_local)
294
 
295
 
296
+ # ๊ทธ๋ผ๋””์˜ค์—์„œ ๋ณด์—ฌ์ค„ ์ถœ๋ ฅ(์ด๋ฏธ์ง€)๊ณผ,
297
+ # ๋‘ ๋ฒˆ์งธ ๋ฒ„ํŠผ์—์„œ ํ™œ์šฉํ•  ์ˆ˜ ์žˆ๋„๋ก final_image๋ฅผ return
298
+ return final_image, final_image
299
+
300
+ def save_final_image(final_img):
301
+ """
302
+ ๋‘ ๋ฒˆ์งธ ๋ฒ„ํŠผ์„ ๋ˆŒ๋ €์„ ๋•Œ(ํ”ผ๋ฆฌํ”ผ๋ฆฌ ์บ์น˜๋ง...),
303
+ ์ด๋ฏธ ์ƒ์„ฑ๋˜์–ด ์žˆ๋˜ final_image๋ฅผ ๋กœ์ปฌ์— ์ €์žฅํ•˜๊ณ ,
304
+ ํ•ด๋‹น ํŒŒ์ผ(๊ฒฝ๋กœ)์„ ๊ทธ๋ผ๋””์˜ค File ์ปดํฌ๋„ŒํŠธ๋กœ ๋ฐ˜ํ™˜ํ•˜์—ฌ ๋‹ค์šด๋กœ๋“œํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•จ.
305
+ """
306
+ now_str = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
307
+ filename = f"caught_{now_str}.png"
308
+ final_img.save(filename)
309
+ return filename
310
 
311
  with gr.Blocks(css=css_code) as interface:
312
  gr.Markdown("<h1 style='font-size:30px;'>์ƒˆ๋กœ์šด ํ‹ฐ๋‹ˆํ•‘์ด ๋‚˜ํƒ€๋‚ฌ๋‹ค!</h1>")