vikramjeetthakur commited on
Commit
83a50ee
·
verified ·
1 Parent(s): 47a34e5

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -0
app.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from transformers import pipeline
3
+ from PIL import Image
4
+
5
+ pipeline = pipeline(task="image-classification", model="julien-c/hotdog-not-hotdog")
6
+ st.title("Image classification : Hot Dog? Or Not?")
7
+ file_name = st.file_uploader("Upload a hot dog candidate image")
8
+
9
+ if file_name is not None:
10
+ col1, col2 = st.columns(2)
11
+ image = Image.open(file_name)
12
+ col1.image(image, use_column_width=True)
13
+ # make predictions for the uploaded image
14
+ predictions = pipeline(image)
15
+ col2.header("Probabilities/result")
16
+ for p in predictions:
17
+ col2.subheader(f"{ p['label'] }: { round(p['score'] * 100, 1)}%")