hylee commited on
Commit
8af9b7c
1 Parent(s): 20055f0
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -16,6 +16,7 @@ import PIL.Image
16
 
17
  from io import BytesIO
18
  from fastai.vision import *
 
19
  from fastai.vision import load_learner
20
 
21
  from core import FeatureLoss
@@ -65,12 +66,13 @@ def run(
65
 
66
  img = PIL.Image.open(image.name)
67
  img_t = T.ToTensor()(img)
68
- img_fast = PIL.Image(img_t)
69
 
70
  p, img_hr, b = learn.predict(img_fast)
71
- r = PIL.Image(img_hr)
72
 
73
- return r
 
 
74
 
75
  learn = None
76
  def main():
 
16
 
17
  from io import BytesIO
18
  from fastai.vision import *
19
+ from fastai.utils.mem import *
20
  from fastai.vision import load_learner
21
 
22
  from core import FeatureLoss
 
66
 
67
  img = PIL.Image.open(image.name)
68
  img_t = T.ToTensor()(img)
69
+ img_fast = Image(img_t)
70
 
71
  p, img_hr, b = learn.predict(img_fast)
 
72
 
73
+ r = np.uint8(np.clip(image2np(img_hr), 0, 1) * 255)
74
+
75
+ return PIL.Image(r)
76
 
77
  learn = None
78
  def main():