Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -11,6 +11,7 @@ import requests # Needed for downloading models
|
|
| 11 |
from tqdm import tqdm # For download progress bar
|
| 12 |
import spaces
|
| 13 |
import functools
|
|
|
|
| 14 |
|
| 15 |
# --- New Official Implementation Imports ---
|
| 16 |
from stablepy import load_upscaler_model
|
|
@@ -28,15 +29,6 @@ DATASET_FILENAME = "upscaler_preferences.csv"
|
|
| 28 |
LOCAL_CSV_PATH = "upscaler_preferences_local.csv" # Local backup for safety
|
| 29 |
PUSH_THRESHOLD = 10 # Push after this many new votes
|
| 30 |
|
| 31 |
-
# This dictionary remains as a global constant as it's static configuration
|
| 32 |
-
UPSCALER_DICT_GUI = {
|
| 33 |
-
"RealESRGAN_x4plus": "https://huggingface.co/ai-forever/Real-ESRGAN/resolve/main/RealESRGAN_x4.pth",
|
| 34 |
-
"RealESRGAN_x2plus": "https://huggingface.co/ai-forever/Real-ESRGAN/resolve/main/RealESRGAN_x2.pth",
|
| 35 |
-
"SwinIR_x4": "https://github.com/JingyunLiang/SwinIR/releases/download/v0.0/001_classicalSR_DIV2K_s48w8_SwinIR-M_x4.pth",
|
| 36 |
-
"BSRGAN_x2": "https://huggingface.co/glassful/models/resolve/main/BSRGANx2.pth",
|
| 37 |
-
"NewModel_x4_beta": "path/to/new_model.pth" # Example of a local model
|
| 38 |
-
}
|
| 39 |
-
|
| 40 |
# --- Helper Functions for New Implementation ---
|
| 41 |
def download_model(directory, url):
|
| 42 |
"""Downloads a file from a URL to a specified directory with a progress bar."""
|
|
|
|
| 11 |
from tqdm import tqdm # For download progress bar
|
| 12 |
import spaces
|
| 13 |
import functools
|
| 14 |
+
from constants import updated_upscaler_dict as UPSCALER_DICT_GUI
|
| 15 |
|
| 16 |
# --- New Official Implementation Imports ---
|
| 17 |
from stablepy import load_upscaler_model
|
|
|
|
| 29 |
LOCAL_CSV_PATH = "upscaler_preferences_local.csv" # Local backup for safety
|
| 30 |
PUSH_THRESHOLD = 10 # Push after this many new votes
|
| 31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
# --- Helper Functions for New Implementation ---
|
| 33 |
def download_model(directory, url):
|
| 34 |
"""Downloads a file from a URL to a specified directory with a progress bar."""
|