Ubuntu
add application file
4a3d4e5
raw
history blame
1.44 kB
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)