Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
@@ -52,22 +52,22 @@ def main():
|
|
52 |
# Load model (uses st.cache_resource)
|
53 |
with st.spinner('Loading model... This may take a moment.'):
|
54 |
model, preprocess, tokenizer = load_model()
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
|
59 |
-
|
60 |
-
|
61 |
|
62 |
-
|
63 |
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
|
72 |
if __name__ == "__main__":
|
73 |
main()
|
|
|
52 |
# Load model (uses st.cache_resource)
|
53 |
with st.spinner('Loading model... This may take a moment.'):
|
54 |
model, preprocess, tokenizer = load_model()
|
55 |
+
except Exception as e:
|
56 |
+
st.error(f"Error loading model: {str(e)}")
|
57 |
+
st.info("Please make sure you have enough memory and the correct dependencies installed.")
|
58 |
|
59 |
+
knn = np.load(modelpath)
|
60 |
+
st.write(knn['walkability_vecs'].shape)
|
61 |
|
62 |
+
file = st.file_uploader('Upload An Image')
|
63 |
|
64 |
+
if file:
|
65 |
+
try:
|
66 |
+
with Image.open(file) as img:
|
67 |
+
st.write(file)
|
68 |
+
st.write(img.size)
|
69 |
+
except Exception as e:
|
70 |
+
st.error(f"Error processing image: {str(e)}")
|
71 |
|
72 |
if __name__ == "__main__":
|
73 |
main()
|