Spaces:
Runtime error
Runtime error
Create new file
Browse files
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]))
|