File size: 833 Bytes
dde79d4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import streamlit as st
from PIL import Image
import torch
from torchvision import transforms
from transformers import AutoImageProcessor
import pandas as pd



# Load the Traffic_Signs_Classification model pipeline
classifier = pipeline("TrafficSigns-classification", model='Rae1230/Traffic_Signs_Classification', return_all_scores=True)
# Streamlit application title
st.title("Speech the Traffic Signs")


uploaded_file = st.file_uploader("Choose a PNG image...", type="png", accept_multiple_files=False)
if uploaded_file is not None:
  image = Image.open(uploaded_file)
  st.image(image, caption='Uploaded Image.', use_column_width=True)
  processor = AutoImageProcessor.from_pretrained("google/vit-base-patch16-224")
  inputs = processor(image.convert('RGB'), return_tensors="pt")
  result=classifier(inputs)
    
st.write(result)