Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,8 +7,8 @@ from huggingface_hub import HfApi
|
|
| 7 |
from io import StringIO
|
| 8 |
from transformers import pipeline
|
| 9 |
import torch
|
| 10 |
-
import requests
|
| 11 |
-
from tqdm import tqdm
|
| 12 |
import spaces
|
| 13 |
import functools
|
| 14 |
from constants import updated_upscaler_dict as UPSCALER_DICT_GUI
|
|
@@ -19,7 +19,6 @@ DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
|
|
| 19 |
DIRECTORY_UPSCALERS = "upscalers"
|
| 20 |
|
| 21 |
# --- Configuration ---
|
| 22 |
-
# Set your Hugging Face Write Token as an environment variable
|
| 23 |
# export HF_TOKEN_ORG="hf_YourTokenHere"
|
| 24 |
HF_TOKEN_ORG = os.getenv("HF_TOKEN_ORG")
|
| 25 |
DATASET_REPO_ID = "TestOrganizationPleaseIgnore/upscale_board_data"
|
|
@@ -337,7 +336,7 @@ class UpscalerApp:
|
|
| 337 |
with gr.Row():
|
| 338 |
with gr.Column(scale=1):
|
| 339 |
input_image_playground = gr.Image(type="pil", label="Source Image", format="png")
|
| 340 |
-
upscaler_model_dropdown = gr.Dropdown(value="
|
| 341 |
run_button_playground = gr.Button("Run Upscale")
|
| 342 |
with gr.Column(scale=2):
|
| 343 |
output_image_playground = gr.Image(label="Upscaled Result", interactive=False, format="png")
|
|
@@ -361,9 +360,7 @@ def gpu_tab1(*args, **kwargs):
|
|
| 361 |
def gpu_tab2(*args, **kwargs):
|
| 362 |
return app.playground_upscale(*args, **kwargs)
|
| 363 |
|
| 364 |
-
# --- Main Execution Block ---
|
| 365 |
if __name__ == "__main__":
|
| 366 |
-
# Before launching, ensure the upscalers directory exists
|
| 367 |
if not os.path.exists(DIRECTORY_UPSCALERS):
|
| 368 |
os.makedirs(DIRECTORY_UPSCALERS)
|
| 369 |
|
|
|
|
| 7 |
from io import StringIO
|
| 8 |
from transformers import pipeline
|
| 9 |
import torch
|
| 10 |
+
import requests
|
| 11 |
+
from tqdm import tqdm
|
| 12 |
import spaces
|
| 13 |
import functools
|
| 14 |
from constants import updated_upscaler_dict as UPSCALER_DICT_GUI
|
|
|
|
| 19 |
DIRECTORY_UPSCALERS = "upscalers"
|
| 20 |
|
| 21 |
# --- Configuration ---
|
|
|
|
| 22 |
# export HF_TOKEN_ORG="hf_YourTokenHere"
|
| 23 |
HF_TOKEN_ORG = os.getenv("HF_TOKEN_ORG")
|
| 24 |
DATASET_REPO_ID = "TestOrganizationPleaseIgnore/upscale_board_data"
|
|
|
|
| 336 |
with gr.Row():
|
| 337 |
with gr.Column(scale=1):
|
| 338 |
input_image_playground = gr.Image(type="pil", label="Source Image", format="png")
|
| 339 |
+
upscaler_model_dropdown = gr.Dropdown(value="R-ESRGAN_4x+", choices=list(UPSCALER_DICT_GUI.keys()), label="Upscaler Model")
|
| 340 |
run_button_playground = gr.Button("Run Upscale")
|
| 341 |
with gr.Column(scale=2):
|
| 342 |
output_image_playground = gr.Image(label="Upscaled Result", interactive=False, format="png")
|
|
|
|
| 360 |
def gpu_tab2(*args, **kwargs):
|
| 361 |
return app.playground_upscale(*args, **kwargs)
|
| 362 |
|
|
|
|
| 363 |
if __name__ == "__main__":
|
|
|
|
| 364 |
if not os.path.exists(DIRECTORY_UPSCALERS):
|
| 365 |
os.makedirs(DIRECTORY_UPSCALERS)
|
| 366 |
|