pmbrito commited on
Commit
df08c0a
1 Parent(s): 1d89df1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -3
app.py CHANGED
@@ -2,6 +2,13 @@ import streamlit as st
2
  from transformers import pipeline
3
 
4
  vision_classifier = pipeline(task="image-classification")
5
- result = vision_classifier(images="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg")
6
- print("\n".join([f"Class {d['label']} with score {round(d['score'], 4)}" for d in result]))
7
- st.text("\n".join([f"Class {d['label']} with score {round(d['score'], 4)}" for d in result]))
 
 
 
 
 
 
 
 
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]))