Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,23 +6,22 @@ from PIL import Image
|
|
| 6 |
image_analysis = pipeline("image-classification", model="google/vit-base-patch16-224-in21k")
|
| 7 |
|
| 8 |
def main():
|
| 9 |
-
st.title("
|
| 10 |
|
| 11 |
-
uploaded_image = st.file_uploader("
|
| 12 |
|
| 13 |
if uploaded_image is not None:
|
| 14 |
-
|
| 15 |
st.image(uploaded_image, caption="รูปภาพที่เลือก", use_column_width=True)
|
| 16 |
|
| 17 |
-
|
| 18 |
image = Image.open(uploaded_image)
|
| 19 |
results = image_analysis(image)
|
| 20 |
|
| 21 |
# แสดงผลลัพธ์
|
| 22 |
st.subheader("ผลลัพธ์การวิเคราะห์รูปภาพ:")
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
|
|
|
| 26 |
|
| 27 |
if __name__ == "__main__":
|
| 28 |
main()
|
|
|
|
| 6 |
image_analysis = pipeline("image-classification", model="google/vit-base-patch16-224-in21k")
|
| 7 |
|
| 8 |
def main():
|
| 9 |
+
st.title("ระบบวิเคราะห์รูปภาพ")
|
| 10 |
|
| 11 |
+
uploaded_image = st.file_uploader("เลือกรูปภาพ", type=["jpg", "jpeg", "png"])
|
| 12 |
|
| 13 |
if uploaded_image is not None:
|
|
|
|
| 14 |
st.image(uploaded_image, caption="รูปภาพที่เลือก", use_column_width=True)
|
| 15 |
|
|
|
|
| 16 |
image = Image.open(uploaded_image)
|
| 17 |
results = image_analysis(image)
|
| 18 |
|
| 19 |
# แสดงผลลัพธ์
|
| 20 |
st.subheader("ผลลัพธ์การวิเคราะห์รูปภาพ:")
|
| 21 |
+
# แสดงผลลัพธ์ที่มีในผลลัพธ์ของโมเดล
|
| 22 |
+
st.write(results[0])
|
| 23 |
+
|
| 24 |
+
print(results[0])
|
| 25 |
|
| 26 |
if __name__ == "__main__":
|
| 27 |
main()
|