TM9450 commited on
Commit
26a4f64
·
1 Parent(s): 8e6322e

Create new file

Browse files
Files changed (1) hide show
  1. app.py +14 -0
app.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from transformers import pipeline
3
+
4
+ vision_classifier = pipeline(task="image-classification")
5
+
6
+ text = st.text_area('Enter a link to an image:')
7
+
8
+ if text:
9
+ result = vision_classifier(images=text)
10
+ st.text("\n".join([f"Class {d['label']} with score {round(d['score'], 4)}" for d in result]))
11
+
12
+ #result = vision_classifier(images="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg")
13
+ #print("\n".join([f"Class {d['label']} with score {round(d['score'], 4)}" for d in result]))
14
+ #st.text("\n".join([f"Class {d['label']} with score {round(d['score'], 4)}" for d in result]))