Spaces:
Sleeping
Sleeping
feat: :fire: hotdog or not
Browse files- .vscode/settings.json +6 -0
- app.py +19 -2
.vscode/settings.json
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"[python]": {
|
3 |
+
"editor.defaultFormatter": "ms-python.autopep8"
|
4 |
+
},
|
5 |
+
"python.formatting.provider": "none"
|
6 |
+
}
|
app.py
CHANGED
@@ -1,4 +1,21 @@
|
|
1 |
import streamlit as st
|
|
|
|
|
2 |
|
3 |
-
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
+
from transformers import pipeline
|
3 |
+
from PIL import Image
|
4 |
|
5 |
+
pipeline = pipeline(task="image-classification",
|
6 |
+
model="julien-c/hotdog-not-hotdog")
|
7 |
+
|
8 |
+
st.title("Hot Dog? Or Not?")
|
9 |
+
|
10 |
+
file_name = st.file_uploader("Upload a hot dog candidate image")
|
11 |
+
|
12 |
+
if file_name is not None:
|
13 |
+
col1, col2 = st.columns(2)
|
14 |
+
|
15 |
+
image = Image.open(file_name)
|
16 |
+
col1.image(image, use_column_width=True)
|
17 |
+
predictions = pipeline(image)
|
18 |
+
|
19 |
+
col2.header("Probabilities")
|
20 |
+
for p in predictions:
|
21 |
+
col2.subheader(f"{ p['label'] }: { round(p['score'] * 100, 1)}%")
|