Spaces:
Starting on T4
Starting on T4
Upload folder using huggingface_hub
Browse files- .idea/workspace.xml +1 -1
- app.py +3 -2
.idea/workspace.xml
CHANGED
|
@@ -74,7 +74,7 @@
|
|
| 74 |
<option name="number" value="Default" />
|
| 75 |
<option name="presentableId" value="Default" />
|
| 76 |
<updated>1706519257550</updated>
|
| 77 |
-
<workItem from="1706519262472" duration="
|
| 78 |
</task>
|
| 79 |
<servers />
|
| 80 |
</component>
|
|
|
|
| 74 |
<option name="number" value="Default" />
|
| 75 |
<option name="presentableId" value="Default" />
|
| 76 |
<updated>1706519257550</updated>
|
| 77 |
+
<workItem from="1706519262472" duration="4411000" />
|
| 78 |
</task>
|
| 79 |
<servers />
|
| 80 |
</component>
|
app.py
CHANGED
|
@@ -21,16 +21,17 @@ def tensor2im(var):
|
|
| 21 |
|
| 22 |
def process(input_image, step=None):
|
| 23 |
progress = gr.Progress()
|
|
|
|
| 24 |
img = tfs(input_image)[None, ...].to(device)
|
|
|
|
| 25 |
if step == None:
|
| 26 |
timesteps = 200
|
| 27 |
else:
|
| 28 |
timesteps = step
|
| 29 |
with torch.no_grad():
|
| 30 |
model.eval()
|
| 31 |
-
b, *_ = img.shape
|
| 32 |
y_t = torch.randn_like(img)
|
| 33 |
-
for i
|
| 34 |
t = torch.full((b,), i, device=img.device, dtype=torch.long)
|
| 35 |
y_t = model(img, y_t, t)
|
| 36 |
# out, _ = model.netG.restoration(img, sample_num=8)
|
|
|
|
| 21 |
|
| 22 |
def process(input_image, step=None):
|
| 23 |
progress = gr.Progress()
|
| 24 |
+
progress(0, desc="Starting...")
|
| 25 |
img = tfs(input_image)[None, ...].to(device)
|
| 26 |
+
b, *_ = img.shape
|
| 27 |
if step == None:
|
| 28 |
timesteps = 200
|
| 29 |
else:
|
| 30 |
timesteps = step
|
| 31 |
with torch.no_grad():
|
| 32 |
model.eval()
|
|
|
|
| 33 |
y_t = torch.randn_like(img)
|
| 34 |
+
for i in progress.tqdm(reversed(range(0, timesteps)), desc='sampling loop time step', total=timesteps):
|
| 35 |
t = torch.full((b,), i, device=img.device, dtype=torch.long)
|
| 36 |
y_t = model(img, y_t, t)
|
| 37 |
# out, _ = model.netG.restoration(img, sample_num=8)
|