File size: 644 Bytes
1d89df1
797b918
 
 
df08c0a
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import streamlit as st
from transformers import pipeline

vision_classifier = pipeline(task="image-classification")

text = st.text_area('Enter a link to an image:')

if text:
  result = vision_classifier(images=text)
  st.text("\n".join([f"Class {d['label']} with score {round(d['score'], 4)}" for d in result]))
  
#result = vision_classifier(images="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg")
#print("\n".join([f"Class {d['label']} with score {round(d['score'], 4)}" for d in result]))
#st.text("\n".join([f"Class {d['label']} with score {round(d['score'], 4)}" for d in result]))