Spaces:
Runtime error
Runtime error
Commit
·
b8a8801
1
Parent(s):
75554ed
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,19 +13,19 @@ to_img=T.ToPILImage()
|
|
| 13 |
example_list = [["examples/" + example] for example in os.listdir("examples")]
|
| 14 |
# example_list=['1.jpg','2.jpg']
|
| 15 |
|
| 16 |
-
# Predict Function
|
| 17 |
def predict(img):
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
y_gen=
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
|
|
|
| 29 |
|
| 30 |
|
| 31 |
# Gradio App
|
|
|
|
| 13 |
example_list = [["examples/" + example] for example in os.listdir("examples")]
|
| 14 |
# example_list=['1.jpg','2.jpg']
|
| 15 |
|
|
|
|
| 16 |
def predict(img):
|
| 17 |
+
# Apply Transformations
|
| 18 |
+
img = transform_gen(img).unsqueeze(0)
|
| 19 |
+
|
| 20 |
+
# Predict
|
| 21 |
+
gen.eval()
|
| 22 |
+
with torch.inference_mode():
|
| 23 |
+
y_gen = gen(img)
|
| 24 |
+
y_gen = y_gen[0]
|
| 25 |
+
y_gen = to_img(y_gen)
|
| 26 |
+
|
| 27 |
+
return y_gen
|
| 28 |
+
|
| 29 |
|
| 30 |
|
| 31 |
# Gradio App
|