Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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 |
-
|
|
|
|
|
|
|
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
|