Spaces:
Sleeping
Sleeping
import streamlit as st | |
import numpy as np | |
with st.sidebar: | |
st.image("logo/logo_small_EQUES.png") | |
st.button("ใซใกใฉใจๆฅ็ถ") | |
from PIL import Image | |
import io | |
uploaded_file = st.file_uploader('็ปๅใใขใใใญใผใ') | |
if uploaded_file is not None: | |
image = Image.open(uploaded_file) | |
img_array = np.array(image) | |
st.image( | |
image, caption='upload images', | |
use_column_width=True | |
) | |
option = st.selectbox( | |
"ใในใ็ปๅใฎไฝฟ็จ", | |
("ใในใ็ปๅ๏ผ", "ใในใ็ปๅ๏ผ", "ใในใ็ปๅ๏ผ"), | |
index=None, | |
placeholder="ใในใ็ปๅใ้ธๆใใฆใใ ใใใ", | |
) | |
if st.button("ไธๅฏฉ่ ใๆค็ฅ"): | |
if option != None: | |
image = Image.open(f"img/sample/{option}.JPG") | |
assert image != None,"็ปๅใใขใใใญใผใใใฆใใ ใใใ" | |
from run import inference | |
with st.spinner("Operation in progress. Please wait."): | |
output, (labels, scores, indices) = inference(image) | |
st.image("img/detected.png") | |
st.title("่งฃๆ็ตๆ") | |
for a,b in zip(labels, scores): | |
st.write(a,b) | |
if len(indices) != 0: | |
st.warning('ไธๅฏฉ่ ใๆค็ฅใใใๅฏ่ฝๆงใใใใพใ', icon="โ ๏ธ") | |
else: | |
st.info('ไธๅฏฉ่ ใฏๆค็ฅใใใพใใใงใใ', icon="โน๏ธ") | |
st.title("่งฃๆ็ตๆ่ฉณ็ดฐ") | |
st.write(output) | |