anvilinteractiv commited on
Commit
723b97e
Β·
verified Β·
1 Parent(s): 441cfcf

Update gradio_app.py

Browse files
Files changed (1) hide show
  1. gradio_app.py +3 -9
gradio_app.py CHANGED
@@ -35,6 +35,7 @@ import os
35
  import subprocess
36
  import sys
37
  import shlex
 
38
 
39
  # Define CURRENT_DIR at the start
40
  CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))
@@ -74,15 +75,8 @@ except Exception as e:
74
  finally:
75
  os.chdir(CURRENT_DIR)
76
 
77
- # Download Real-ESRGAN model
78
- print("Downloading Real-ESRGAN model...")
79
- try:
80
- os.makedirs("/home/user/app/hy3dpaint/ckpt", exist_ok=True)
81
- realesrgan_url = "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth"
82
- subprocess.run(["wget", realesrgan_url, "-P", "/home/user/app/hy3dpaint/ckpt"], check=True, capture_output=True, text=True)
83
- print("Successfully downloaded Real-ESRGAN model")
84
- except Exception as e:
85
- print(f"Error downloading Real-ESRGAN: {e}. Please manually upload RealESRGAN_x4plus.pth to hy3dpaint/ckpt.")
86
 
87
 
88
  def get_example_img_list():
 
35
  import subprocess
36
  import sys
37
  import shlex
38
+ import spaces # Add spaces import for @spaces.GPU decorator
39
 
40
  # Define CURRENT_DIR at the start
41
  CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))
 
75
  finally:
76
  os.chdir(CURRENT_DIR)
77
 
78
+ # Skip Real-ESRGAN download since it succeeded
79
+ print("Real-ESRGAN model already downloaded to /home/user/app/hy3dpaint/ckpt/RealESRGAN_x4plus.pth")
 
 
 
 
 
 
 
80
 
81
 
82
  def get_example_img_list():