Spaces:
Runtime error
Runtime error
mookkanvas
commited on
Commit
•
976e83f
1
Parent(s):
1de979a
Update app.py
Browse files
app.py
CHANGED
@@ -11,7 +11,7 @@ def predict(image):
|
|
11 |
return {p["label"]: p["score"] for p in predictions}
|
12 |
|
13 |
def main():
|
14 |
-
st.title("
|
15 |
|
16 |
with st.form("my_form"):
|
17 |
uploaded_file = st.file_uploader("Choose an image file", type=["jpg", "jpeg", "png"])
|
@@ -19,8 +19,8 @@ def main():
|
|
19 |
if uploaded_file is not None:
|
20 |
# Display the uploaded image
|
21 |
image = Image.open(uploaded_file)
|
22 |
-
st.image(image, caption="
|
23 |
-
clicked = st.form_submit_button("
|
24 |
if clicked:
|
25 |
results = predict(image)
|
26 |
k = []
|
@@ -31,7 +31,7 @@ def main():
|
|
31 |
k.append(key)
|
32 |
vp = [str(item) + '%' for item in v]
|
33 |
result = k[0]
|
34 |
-
st.success('The predicted
|
35 |
df = pd.DataFrame({'Prediction': k,'Accuracy':vp})
|
36 |
st.dataframe(df,hide_index=True)
|
37 |
|
|
|
11 |
return {p["label"]: p["score"] for p in predictions}
|
12 |
|
13 |
def main():
|
14 |
+
st.title("Age Classification From Image")
|
15 |
|
16 |
with st.form("my_form"):
|
17 |
uploaded_file = st.file_uploader("Choose an image file", type=["jpg", "jpeg", "png"])
|
|
|
19 |
if uploaded_file is not None:
|
20 |
# Display the uploaded image
|
21 |
image = Image.open(uploaded_file)
|
22 |
+
st.image(image, caption="Your uploaded Image", use_column_width=True)
|
23 |
+
clicked = st.form_submit_button("Press to predict")
|
24 |
if clicked:
|
25 |
results = predict(image)
|
26 |
k = []
|
|
|
31 |
k.append(key)
|
32 |
vp = [str(item) + '%' for item in v]
|
33 |
result = k[0]
|
34 |
+
st.success('The predicted age is {}'.format(result))
|
35 |
df = pd.DataFrame({'Prediction': k,'Accuracy':vp})
|
36 |
st.dataframe(df,hide_index=True)
|
37 |
|