Update app2.py
Browse files
app2.py
CHANGED
|
@@ -15,22 +15,6 @@ variant = 'diffusion_transformer_768p' # For high resolution
|
|
| 15 |
current_directory = os.getcwd()
|
| 16 |
model_path = os.path.join(current_directory, "pyramid_flow_model") # Directory to store the model
|
| 17 |
|
| 18 |
-
# Download the model if not already present
|
| 19 |
-
def download_model_from_hf(model_repo, model_dir):
|
| 20 |
-
if not os.path.exists(model_dir):
|
| 21 |
-
print(f"Downloading model from {model_repo} to {model_dir}...")
|
| 22 |
-
snapshot_download(
|
| 23 |
-
repo_id=model_repo,
|
| 24 |
-
local_dir=model_dir,
|
| 25 |
-
local_dir_use_symlinks=False,
|
| 26 |
-
repo_type='model'
|
| 27 |
-
)
|
| 28 |
-
print("Model download complete.")
|
| 29 |
-
else:
|
| 30 |
-
print(f"Model directory '{model_dir}' already exists. Skipping download.")
|
| 31 |
-
|
| 32 |
-
# Download model from Hugging Face if not present
|
| 33 |
-
download_model_from_hf(model_repo, model_path)
|
| 34 |
|
| 35 |
# Initialize model and move to CUDA
|
| 36 |
torch.cuda.set_device(0)
|
|
|
|
| 15 |
current_directory = os.getcwd()
|
| 16 |
model_path = os.path.join(current_directory, "pyramid_flow_model") # Directory to store the model
|
| 17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
# Initialize model and move to CUDA
|
| 20 |
torch.cuda.set_device(0)
|