Upload 171 files
Browse files- README.md +1 -1
- __pycache__/app.cpython-313.pyc +0 -0
- app.py +73 -4
- requirements.txt +1 -1
README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
---
|
| 2 |
title: SUPIR
|
| 3 |
sdk: gradio
|
| 4 |
-
sdk_version: "
|
| 5 |
app_file: app.py
|
| 6 |
python_version: "3.10"
|
| 7 |
hf_oauth: true
|
|
|
|
| 1 |
---
|
| 2 |
title: SUPIR
|
| 3 |
sdk: gradio
|
| 4 |
+
sdk_version: "5.12.0"
|
| 5 |
app_file: app.py
|
| 6 |
python_version: "3.10"
|
| 7 |
hf_oauth: true
|
__pycache__/app.cpython-313.pyc
CHANGED
|
Binary files a/__pycache__/app.cpython-313.pyc and b/__pycache__/app.cpython-313.pyc differ
|
|
|
app.py
CHANGED
|
@@ -195,9 +195,75 @@ def stage1_process(
|
|
| 195 |
print('<<== stage1_process')
|
| 196 |
return LQ, gr.update(visible = True)
|
| 197 |
|
| 198 |
-
def stage2_process(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 199 |
try:
|
| 200 |
-
return restore_in_Xmin(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 201 |
except Exception as e:
|
| 202 |
message = str(e)
|
| 203 |
print("gradio.exceptions.Error: 'No GPU is currently available for you after 60s'")
|
|
@@ -214,6 +280,11 @@ def stage2_process(*args, request: gr.Request = None, profile: Optional[gr.OAuth
|
|
| 214 |
"Steps <= 28, and smaller output size."
|
| 215 |
)
|
| 216 |
if "ZeroGPU quotas" in message or "Unlogged user" in message:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 217 |
raise gr.Error(
|
| 218 |
"ZeroGPU received this request as unlogged. Click Sign in with HF, refresh the page, and try again."
|
| 219 |
)
|
|
@@ -729,8 +800,6 @@ with gr.Blocks() as interface:
|
|
| 729 |
with gr.Row():
|
| 730 |
if hasattr(gr, "LoginButton"):
|
| 731 |
login_button = gr.LoginButton("Sign in with HF", scale=0, min_width=180)
|
| 732 |
-
if hasattr(login_button, "activate"):
|
| 733 |
-
login_button.activate()
|
| 734 |
else:
|
| 735 |
gr.Markdown("Use the Hugging Face page login to authenticate.", scale=0)
|
| 736 |
auth_status = gr.Markdown()
|
|
|
|
| 195 |
print('<<== stage1_process')
|
| 196 |
return LQ, gr.update(visible = True)
|
| 197 |
|
| 198 |
+
def stage2_process(
|
| 199 |
+
noisy_image,
|
| 200 |
+
rotation,
|
| 201 |
+
denoise_image,
|
| 202 |
+
prompt,
|
| 203 |
+
a_prompt,
|
| 204 |
+
n_prompt,
|
| 205 |
+
num_samples,
|
| 206 |
+
min_size,
|
| 207 |
+
downscale,
|
| 208 |
+
upscale,
|
| 209 |
+
edm_steps,
|
| 210 |
+
s_stage1,
|
| 211 |
+
s_stage2,
|
| 212 |
+
s_cfg,
|
| 213 |
+
randomize_seed,
|
| 214 |
+
seed,
|
| 215 |
+
s_churn,
|
| 216 |
+
s_noise,
|
| 217 |
+
color_fix_type,
|
| 218 |
+
diff_dtype,
|
| 219 |
+
ae_dtype,
|
| 220 |
+
gamma_correction,
|
| 221 |
+
linear_CFG,
|
| 222 |
+
linear_s_stage2,
|
| 223 |
+
spt_linear_CFG,
|
| 224 |
+
spt_linear_s_stage2,
|
| 225 |
+
model_select,
|
| 226 |
+
output_format,
|
| 227 |
+
allocation,
|
| 228 |
+
request: gr.Request = None,
|
| 229 |
+
profile: Optional[gr.OAuthProfile] = None,
|
| 230 |
+
):
|
| 231 |
+
username = _resolved_username(profile, request)
|
| 232 |
+
print("ZeroGPU auth user: " + (f"@{username}" if username else "<none>"))
|
| 233 |
try:
|
| 234 |
+
return restore_in_Xmin(
|
| 235 |
+
noisy_image,
|
| 236 |
+
rotation,
|
| 237 |
+
denoise_image,
|
| 238 |
+
prompt,
|
| 239 |
+
a_prompt,
|
| 240 |
+
n_prompt,
|
| 241 |
+
num_samples,
|
| 242 |
+
min_size,
|
| 243 |
+
downscale,
|
| 244 |
+
upscale,
|
| 245 |
+
edm_steps,
|
| 246 |
+
s_stage1,
|
| 247 |
+
s_stage2,
|
| 248 |
+
s_cfg,
|
| 249 |
+
randomize_seed,
|
| 250 |
+
seed,
|
| 251 |
+
s_churn,
|
| 252 |
+
s_noise,
|
| 253 |
+
color_fix_type,
|
| 254 |
+
diff_dtype,
|
| 255 |
+
ae_dtype,
|
| 256 |
+
gamma_correction,
|
| 257 |
+
linear_CFG,
|
| 258 |
+
linear_s_stage2,
|
| 259 |
+
spt_linear_CFG,
|
| 260 |
+
spt_linear_s_stage2,
|
| 261 |
+
model_select,
|
| 262 |
+
output_format,
|
| 263 |
+
allocation,
|
| 264 |
+
request=request,
|
| 265 |
+
profile=profile,
|
| 266 |
+
)
|
| 267 |
except Exception as e:
|
| 268 |
message = str(e)
|
| 269 |
print("gradio.exceptions.Error: 'No GPU is currently available for you after 60s'")
|
|
|
|
| 280 |
"Steps <= 28, and smaller output size."
|
| 281 |
)
|
| 282 |
if "ZeroGPU quotas" in message or "Unlogged user" in message:
|
| 283 |
+
if username:
|
| 284 |
+
raise gr.Error(
|
| 285 |
+
"ZeroGPU did not receive your logged-in session. Refresh the page and retry. "
|
| 286 |
+
"If this persists, upgrade the Space to Gradio 5.12+."
|
| 287 |
+
)
|
| 288 |
raise gr.Error(
|
| 289 |
"ZeroGPU received this request as unlogged. Click Sign in with HF, refresh the page, and try again."
|
| 290 |
)
|
|
|
|
| 800 |
with gr.Row():
|
| 801 |
if hasattr(gr, "LoginButton"):
|
| 802 |
login_button = gr.LoginButton("Sign in with HF", scale=0, min_width=180)
|
|
|
|
|
|
|
| 803 |
else:
|
| 804 |
gr.Markdown("Use the Hugging Face page login to authenticate.", scale=0)
|
| 805 |
auth_status = gr.Markdown()
|
requirements.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
gradio==
|
| 2 |
gradio_imageslider==0.0.17
|
| 3 |
huggingface_hub==0.20.3
|
| 4 |
spaces==0.47.0
|
|
|
|
| 1 |
+
gradio==5.12.0
|
| 2 |
gradio_imageslider==0.0.17
|
| 3 |
huggingface_hub==0.20.3
|
| 4 |
spaces==0.47.0
|