Imadsarvm commited on
Commit
db008a4
·
verified ·
1 Parent(s): a1c1394

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -58,12 +58,14 @@ transform = transforms.Compose([GOSNormalize([0.5,0.5,0.5],[1.0,1.0,1.0])])
58
  def get_url_im(t):
59
  user_agent = {'User-agent': 'gradio-app'}
60
  response = requests.get(t, headers=user_agent)
61
- return Image.open(BytesIO(response.content))
62
 
63
 
64
  def load_image(im_path, hypar):
65
  # im_path = BytesIO(requests.get(im_path).content)
66
- im = get_url_im(im_path)
 
 
67
  im, im_shp = im_preprocess(im, hypar["cache_size"])
68
  im = torch.divide(im,255.0)
69
  shape = torch.from_numpy(np.array(im_shp))
 
58
  def get_url_im(t):
59
  user_agent = {'User-agent': 'gradio-app'}
60
  response = requests.get(t, headers=user_agent)
61
+ return (BytesIO(response.content))
62
 
63
 
64
  def load_image(im_path, hypar):
65
  # im_path = BytesIO(requests.get(im_path).content)
66
+
67
+ im_path = get_url_im(im_path)
68
+ im = im_reader(im_path)
69
  im, im_shp = im_preprocess(im, hypar["cache_size"])
70
  im = torch.divide(im,255.0)
71
  shape = torch.from_numpy(np.array(im_shp))