Spaces:
Running
Running
Commit
·
9dc35b4
1
Parent(s):
c01fb47
Update app.py
Browse files
app.py
CHANGED
@@ -3,7 +3,8 @@ import streamlit as st
|
|
3 |
import numpy as np
|
4 |
import PIL
|
5 |
import urllib.request
|
6 |
-
from utils import *
|
|
|
7 |
|
8 |
# Function to classify the garbage
|
9 |
def classify_garbage(img_path, model):
|
@@ -28,12 +29,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 =
|
32 |
|
33 |
elif opt == 'Upload image via link':
|
34 |
img_url = st.text_input('Enter the Image Address')
|
35 |
try:
|
36 |
-
image =
|
37 |
except ValueError:
|
38 |
st.error("Please Enter a valid Image Address!")
|
39 |
|
|
|
3 |
import numpy as np
|
4 |
import PIL
|
5 |
import urllib.request
|
6 |
+
from utils import *
|
7 |
+
from fastai.basics import *
|
8 |
|
9 |
# Function to classify the garbage
|
10 |
def classify_garbage(img_path, model):
|
|
|
29 |
if opt == 'Upload image from device':
|
30 |
file = st.file_uploader('Select', type=['jpg', 'png', 'jpeg'])
|
31 |
if file is not None:
|
32 |
+
image = to_image(file).resize((256, 256), Image.LANCZOS)
|
33 |
|
34 |
elif opt == 'Upload image via link':
|
35 |
img_url = st.text_input('Enter the Image Address')
|
36 |
try:
|
37 |
+
image = to_image(urllib.request.urlopen(img_url)).resize((256, 256), Image.LANCZOS)
|
38 |
except ValueError:
|
39 |
st.error("Please Enter a valid Image Address!")
|
40 |
|