Spaces:
Running
Running
Commit
·
c01fb47
1
Parent(s):
c384497
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
import time
|
2 |
import streamlit as st
|
3 |
import numpy as np
|
4 |
-
|
5 |
import urllib.request
|
6 |
from utils import * # Assuming the gen_labels() and preprocess() functions are in this module
|
7 |
|
@@ -28,12 +28,12 @@ opt = st.selectbox("How do you want to upload the image for classification?", ('
|
|
28 |
if opt == 'Upload image from device':
|
29 |
file = st.file_uploader('Select', type=['jpg', 'png', 'jpeg'])
|
30 |
if file is not None:
|
31 |
-
image = (file).resize((256, 256), Image.LANCZOS)
|
32 |
|
33 |
elif opt == 'Upload image via link':
|
34 |
img_url = st.text_input('Enter the Image Address')
|
35 |
try:
|
36 |
-
image = (urllib.request.urlopen(img_url)).resize((256, 256), Image.LANCZOS)
|
37 |
except ValueError:
|
38 |
st.error("Please Enter a valid Image Address!")
|
39 |
|
|
|
1 |
import time
|
2 |
import streamlit as st
|
3 |
import numpy as np
|
4 |
+
import PIL
|
5 |
import urllib.request
|
6 |
from utils import * # Assuming the gen_labels() and preprocess() functions are in this module
|
7 |
|
|
|
28 |
if opt == 'Upload image from device':
|
29 |
file = st.file_uploader('Select', type=['jpg', 'png', 'jpeg'])
|
30 |
if file is not None:
|
31 |
+
image = PIL.Image.open(file).resize((256, 256), Image.LANCZOS)
|
32 |
|
33 |
elif opt == 'Upload image via link':
|
34 |
img_url = st.text_input('Enter the Image Address')
|
35 |
try:
|
36 |
+
image = PIL.Image.open(urllib.request.urlopen(img_url)).resize((256, 256), Image.LANCZOS)
|
37 |
except ValueError:
|
38 |
st.error("Please Enter a valid Image Address!")
|
39 |
|