Omnibus commited on
Commit
096bee8
·
1 Parent(s): 268e717

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -1
app.py CHANGED
@@ -4,6 +4,12 @@ from transformers import AutoFeatureExtractor, AutoModelForImageClassification,
4
  from numpy import exp
5
  import pandas as pd
6
  from PIL import Image
 
 
 
 
 
 
7
  def softmax(vector):
8
  e = exp(vector)
9
  return e / e.sum()
@@ -91,7 +97,10 @@ def aiornot2(image):
91
  return gr.HTML.update(html_out),results
92
  def load_url(url):
93
  try:
94
- image = Image.open(url)
 
 
 
95
  mes = "Image Loaded"
96
  except Exception as e:
97
  image=None
 
4
  from numpy import exp
5
  import pandas as pd
6
  from PIL import Image
7
+ import urllib.request
8
+ import uuid
9
+ uid=uuid.uuid4()
10
+
11
+
12
+
13
  def softmax(vector):
14
  e = exp(vector)
15
  return e / e.sum()
 
97
  return gr.HTML.update(html_out),results
98
  def load_url(url):
99
  try:
100
+ urllib.request.urlretrieve(
101
+ f'{url}',
102
+ f"{uid}tmp_im.png")
103
+ image = Image.open(f"{uid}tmp_im.png")
104
  mes = "Image Loaded"
105
  except Exception as e:
106
  image=None