Spaces:
Sleeping
Sleeping
Create Traffic_Signs_Classification
Browse files- Traffic_Signs_Classification +24 -0
Traffic_Signs_Classification
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from PIL import Image
|
3 |
+
import torch
|
4 |
+
from torchvision import transforms
|
5 |
+
from transformers import AutoImageProcessor
|
6 |
+
import pandas as pd
|
7 |
+
|
8 |
+
|
9 |
+
|
10 |
+
# Load the Traffic_Signs_Classification model pipeline
|
11 |
+
classifier = pipeline("TrafficSigns-classification", model='Rae1230/Traffic_Signs_Classification', return_all_scores=True)
|
12 |
+
# Streamlit application title
|
13 |
+
st.title("Speech the Traffic Signs")
|
14 |
+
|
15 |
+
|
16 |
+
uploaded_file = st.file_uploader("Choose a PNG image...", type="png", accept_multiple_files=False)
|
17 |
+
if uploaded_file is not None:
|
18 |
+
image = Image.open(uploaded_file)
|
19 |
+
st.image(image, caption='Uploaded Image.', use_column_width=True)
|
20 |
+
processor = AutoImageProcessor.from_pretrained("google/vit-base-patch16-224")
|
21 |
+
inputs = processor(image.convert('RGB'), return_tensors="pt")
|
22 |
+
result=classifier(inputs)
|
23 |
+
|
24 |
+
st.write(result)
|