Spaces:
Sleeping
Sleeping
fahmiaziz98
commited on
Commit
·
628165b
1
Parent(s):
43148dc
first commit
Browse files
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 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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)
|