Spaces:
Runtime error
Runtime error
fix version
Browse files- app.py +15 -11
- app_old.py → app_wget.py +11 -15
- requirements.txt +1 -0
app.py
CHANGED
|
@@ -1,25 +1,29 @@
|
|
|
|
|
| 1 |
import spaces
|
| 2 |
import os
|
|
|
|
| 3 |
import json
|
| 4 |
import torch
|
| 5 |
-
|
| 6 |
-
import
|
| 7 |
-
|
| 8 |
-
from
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
|
| 11 |
model_path = "ckpts"
|
| 12 |
os.makedirs(model_path, exist_ok=True)
|
| 13 |
|
| 14 |
-
# Download files from Hugging Face repository using wget
|
| 15 |
-
def download_huggingface_files():
|
| 16 |
-
# URL to the Hugging Face repository
|
| 17 |
-
repo_url = "https://huggingface.co/pandaphd/generative_photography/tree/main/"
|
| 18 |
-
# Using wget to download all the files from the given Hugging Face repository
|
| 19 |
-
subprocess.run(["wget", "-r", "-np", "-nH", "--cut-dirs=3", "-P", model_path, repo_url])
|
| 20 |
|
| 21 |
print("Downloading models from Hugging Face...")
|
| 22 |
-
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
|
| 25 |
torch.manual_seed(42)
|
|
|
|
| 1 |
+
|
| 2 |
import spaces
|
| 3 |
import os
|
| 4 |
+
import gradio as gr
|
| 5 |
import json
|
| 6 |
import torch
|
| 7 |
+
|
| 8 |
+
from huggingface_hub import snapshot_download
|
| 9 |
+
|
| 10 |
+
from inference_bokehK import load_models as load_bokeh_models, run_inference as run_bokeh_inference, OmegaConf
|
| 11 |
+
from inference_focal_length import load_models as load_focal_models, run_inference as run_focal_inference
|
| 12 |
+
from inference_shutter_speed import load_models as load_shutter_models, run_inference as run_shutter_inference
|
| 13 |
+
from inference_color_temperature import load_models as load_color_models, run_inference as run_color_inference
|
| 14 |
+
|
| 15 |
+
|
| 16 |
|
| 17 |
|
| 18 |
model_path = "ckpts"
|
| 19 |
os.makedirs(model_path, exist_ok=True)
|
| 20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
print("Downloading models from Hugging Face...")
|
| 23 |
+
snapshot_download(repo_id="pandaphd/generative_photography", local_dir=model_path)
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
|
| 27 |
|
| 28 |
|
| 29 |
torch.manual_seed(42)
|
app_old.py → app_wget.py
RENAMED
|
@@ -1,29 +1,25 @@
|
|
| 1 |
-
|
| 2 |
import spaces
|
| 3 |
import os
|
| 4 |
-
import gradio as gr
|
| 5 |
import json
|
| 6 |
import torch
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
from
|
| 11 |
-
from inference_focal_length import load_models as load_focal_models, run_inference as run_focal_inference
|
| 12 |
-
from inference_shutter_speed import load_models as load_shutter_models, run_inference as run_shutter_inference
|
| 13 |
-
from inference_color_temperature import load_models as load_color_models, run_inference as run_color_inference
|
| 14 |
-
|
| 15 |
-
|
| 16 |
|
| 17 |
|
| 18 |
model_path = "ckpts"
|
| 19 |
os.makedirs(model_path, exist_ok=True)
|
| 20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
print("Downloading models from Hugging Face...")
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
|
| 28 |
|
| 29 |
torch.manual_seed(42)
|
|
|
|
|
|
|
| 1 |
import spaces
|
| 2 |
import os
|
|
|
|
| 3 |
import json
|
| 4 |
import torch
|
| 5 |
+
import requests
|
| 6 |
+
import subprocess
|
| 7 |
+
import gradio as gr
|
| 8 |
+
from omegaconf import OmegaConf
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
|
| 11 |
model_path = "ckpts"
|
| 12 |
os.makedirs(model_path, exist_ok=True)
|
| 13 |
|
| 14 |
+
# Download files from Hugging Face repository using wget
|
| 15 |
+
def download_huggingface_files():
|
| 16 |
+
# URL to the Hugging Face repository
|
| 17 |
+
repo_url = "https://huggingface.co/pandaphd/generative_photography/tree/main/"
|
| 18 |
+
# Using wget to download all the files from the given Hugging Face repository
|
| 19 |
+
subprocess.run(["wget", "-r", "-np", "-nH", "--cut-dirs=3", "-P", model_path, repo_url])
|
| 20 |
|
| 21 |
print("Downloading models from Hugging Face...")
|
| 22 |
+
download_huggingface_files()
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
|
| 25 |
torch.manual_seed(42)
|
requirements.txt
CHANGED
|
@@ -7,6 +7,7 @@ imageio-ffmpeg
|
|
| 7 |
numpy==1.24.4
|
| 8 |
transformers==4.39.3
|
| 9 |
accelerate==0.30.0
|
|
|
|
| 10 |
opencv-python
|
| 11 |
gdown
|
| 12 |
einops
|
|
|
|
| 7 |
numpy==1.24.4
|
| 8 |
transformers==4.39.3
|
| 9 |
accelerate==0.30.0
|
| 10 |
+
huggingface_hub==0.30.0
|
| 11 |
opencv-python
|
| 12 |
gdown
|
| 13 |
einops
|