fahmiaziz98 commited on
Commit
628165b
·
1 Parent(s): 43148dc

first commit

Browse files
Files changed (1) hide show
  1. app.py +17 -9
app.py CHANGED
@@ -74,12 +74,20 @@ if model_choice == "VIT Pose Classification":
74
 
75
  if uploaded_file is not None:
76
  image = Image.open(uploaded_file)
77
- st.image(image, caption="Your Image", width=300)
78
-
79
- image_processor = AutoImageProcessor.from_pretrained(local_path, use_fast=True)
80
- pipe = pipeline('image-classification', model=local_path, image_processor=image_processor, device=device)
81
-
82
- if predict:
83
- with st.spinner("Predicting..."):
84
- output = pipe(image)
85
- st.write(output)
 
 
 
 
 
 
 
 
 
74
 
75
  if uploaded_file is not None:
76
  image = Image.open(uploaded_file)
77
+ col1, col2 = st.columns([1, 1])
78
+
79
+ with col1:
80
+ st.image(image, caption="Your Image", width=300)
81
+
82
+ with col2:
83
+ try:
84
+ image_processor = AutoImageProcessor.from_pretrained(local_path, use_fast=True)
85
+ pipe = pipeline('image-classification', model=local_path, image_processor=image_processor, device=device)
86
+ except OSError:
87
+ st.error("❌ Model not found. Please download the model first.")
88
+ pipe = None
89
+
90
+ if predict and pipe:
91
+ with st.spinner("Predicting..."):
92
+ output = pipe(image)
93
+ st.write(output)