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()