aiqtech commited on
Commit
ea4e2a2
ยท
verified ยท
1 Parent(s): 27c7428

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -298,6 +298,10 @@ def image_to_3d(trial_id: str, seed: int, randomize_seed: bool, ss_guidance_stre
298
  clear_gpu_memory()
299
  return None, None
300
 
 
 
 
 
301
  def clear_gpu_memory():
302
  """GPU ๋ฉ”๋ชจ๋ฆฌ๋ฅผ ๋” ์ฒ ์ €ํ•˜๊ฒŒ ์ •๋ฆฌํ•˜๋Š” ํ•จ์ˆ˜"""
303
  try:
@@ -409,6 +413,10 @@ def text_to_image(prompt: str, height: int, width: int, steps: int, scales: floa
409
  torch.cuda.synchronize()
410
  gc.collect()
411
 
 
 
 
 
412
  css = """
413
  footer {
414
  visibility: hidden;
@@ -612,9 +620,6 @@ if __name__ == "__main__":
612
  print("Warning: trellis_pipeline is None")
613
  except Exception as e:
614
  print(f"Warning: Initial preprocessing test failed: {e}")
615
-
616
- # ์ฃผ๊ธฐ์  ์ •๋ฆฌ ์„ค์ •
617
- demo.load(periodic_cleanup, every=5) # 5์ดˆ๋งˆ๋‹ค ์ •๋ฆฌ
618
 
619
  # Gradio ์ธํ„ฐํŽ˜์ด์Šค ์‹คํ–‰
620
  demo.queue() # ํ ๊ธฐ๋Šฅ ํ™œ์„ฑํ™”
 
298
  clear_gpu_memory()
299
  return None, None
300
 
301
+ return generated_image
302
+ finally:
303
+ clear_gpu_memory() # ํ•จ์ˆ˜ ์ข…๋ฃŒ ์‹œ ๋ฉ”๋ชจ๋ฆฌ ์ •๋ฆฌ
304
+
305
  def clear_gpu_memory():
306
  """GPU ๋ฉ”๋ชจ๋ฆฌ๋ฅผ ๋” ์ฒ ์ €ํ•˜๊ฒŒ ์ •๋ฆฌํ•˜๋Š” ํ•จ์ˆ˜"""
307
  try:
 
413
  torch.cuda.synchronize()
414
  gc.collect()
415
 
416
+ return generated_image
417
+ finally:
418
+ clear_gpu_memory() # ํ•จ์ˆ˜ ์ข…๋ฃŒ ์‹œ ๋ฉ”๋ชจ๋ฆฌ ์ •๋ฆฌ
419
+
420
  css = """
421
  footer {
422
  visibility: hidden;
 
620
  print("Warning: trellis_pipeline is None")
621
  except Exception as e:
622
  print(f"Warning: Initial preprocessing test failed: {e}")
 
 
 
623
 
624
  # Gradio ์ธํ„ฐํŽ˜์ด์Šค ์‹คํ–‰
625
  demo.queue() # ํ ๊ธฐ๋Šฅ ํ™œ์„ฑํ™”