Spaces:
Runtime error
Runtime error
File size: 1,063 Bytes
ac3698c 944b3d8 78d1f79 ac3698c bbd1d41 944b3d8 bbd1d41 944b3d8 6233630 2011ca9 6233630 2011ca9 6233630 3e84abd 3df1632 bbd1d41 ac3698c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | import streamlit as st
from transformers import pipeline
from PIL import Image
image_analysis = pipeline("image-classification", model="google/vit-base-patch16-224-in21k")
def main():
st.title("ระบบวิเคราะห์รูปภาพ")
uploaded_image = st.file_uploader("เลือกรูปภาพ", type=["jpg", "jpeg", "png"])
if uploaded_image is not None:
# แสดงรูปภาพที่อัปโหลด
st.image(uploaded_image, caption="รูปภาพที่เลือก", use_column_width=True)
# ทำการวิเคราะห์รูปภาพ
image = Image.open(uploaded_image)
results = image_analysis(image)
# แสดงผลลัพธ์
st.subheader("ผลลัพธ์การวิเคราะห์รูปภาพ:")
# แสดงผลลัพธ์ที่มีในผลลัพธ์ของโมเดล
st.write(results[0])
if __name__ == "__main__":
main()
|