Harsimran19 commited on
Commit
b8a8801
·
1 Parent(s): 75554ed

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -12
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
- # Apply Transformations
19
- img=np.array(img)
20
- img=transform_gen(img).unsqueeze(0)
21
-
22
- # Predict
23
- gen.eval()
24
- with torch.inference_mode():
25
- y_gen=gen(img)
26
- y_gen=y_gen[0]
27
- y_gen=to_img(y_gen)
28
- return y_gen
 
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