Spaces:
Running
on
Zero
Running
on
Zero
ZeroGPU test
Browse files- app_function.py +4 -1
- requirements.txt +2 -1
app_function.py
CHANGED
|
@@ -5,6 +5,7 @@ import torch
|
|
| 5 |
import yaml
|
| 6 |
import gradio as gr
|
| 7 |
import tempfile
|
|
|
|
| 8 |
|
| 9 |
# os.environ['CUDA_VISIBLE_DEVICES'] = '0'
|
| 10 |
import time
|
|
@@ -219,6 +220,7 @@ class YOND_Backend:
|
|
| 219 |
gr.Error(f"图像更新失败: {str(e)}")
|
| 220 |
raise RuntimeError(f"图像更新失败: {str(e)}") from e
|
| 221 |
|
|
|
|
| 222 |
def estimate_noise(self, double_est, ransac, patch_size):
|
| 223 |
"""执行噪声估计"""
|
| 224 |
if not self.yond:
|
|
@@ -298,6 +300,7 @@ class YOND_Backend:
|
|
| 298 |
gr.Error(f"噪声估计失败: {str(e)}")
|
| 299 |
raise RuntimeError(f"噪声估计失败: {str(e)}") from e
|
| 300 |
|
|
|
|
| 301 |
def enhance_image(self, gain, sigma, sigsnr, ddim_mode, patch_size):
|
| 302 |
"""执行图像增强"""
|
| 303 |
if not self.yond:
|
|
@@ -440,7 +443,7 @@ class YOND_Backend:
|
|
| 440 |
return tmp_file_path_png
|
| 441 |
|
| 442 |
class YONDParser():
|
| 443 |
-
def __init__(self, yaml_path="runfiles/Gaussian/
|
| 444 |
self.runfile = yaml_path
|
| 445 |
self.mode = 'eval'
|
| 446 |
self.debug = False
|
|
|
|
| 5 |
import yaml
|
| 6 |
import gradio as gr
|
| 7 |
import tempfile
|
| 8 |
+
import spaces
|
| 9 |
|
| 10 |
# os.environ['CUDA_VISIBLE_DEVICES'] = '0'
|
| 11 |
import time
|
|
|
|
| 220 |
gr.Error(f"图像更新失败: {str(e)}")
|
| 221 |
raise RuntimeError(f"图像更新失败: {str(e)}") from e
|
| 222 |
|
| 223 |
+
@spaces.GPU
|
| 224 |
def estimate_noise(self, double_est, ransac, patch_size):
|
| 225 |
"""执行噪声估计"""
|
| 226 |
if not self.yond:
|
|
|
|
| 300 |
gr.Error(f"噪声估计失败: {str(e)}")
|
| 301 |
raise RuntimeError(f"噪声估计失败: {str(e)}") from e
|
| 302 |
|
| 303 |
+
@spaces.GPU
|
| 304 |
def enhance_image(self, gain, sigma, sigsnr, ddim_mode, patch_size):
|
| 305 |
"""执行图像增强"""
|
| 306 |
if not self.yond:
|
|
|
|
| 443 |
return tmp_file_path_png
|
| 444 |
|
| 445 |
class YONDParser():
|
| 446 |
+
def __init__(self, yaml_path="runfiles/Gaussian/gru32n_paper_noclip.yml"):
|
| 447 |
self.runfile = yaml_path
|
| 448 |
self.mode = 'eval'
|
| 449 |
self.debug = False
|
requirements.txt
CHANGED
|
@@ -19,4 +19,5 @@ Pillow
|
|
| 19 |
einops
|
| 20 |
timm
|
| 21 |
pyarmor
|
| 22 |
-
pytorch_wavelets
|
|
|
|
|
|
| 19 |
einops
|
| 20 |
timm
|
| 21 |
pyarmor
|
| 22 |
+
pytorch_wavelets
|
| 23 |
+
spaces
|