Spaces:
Runtime error
Runtime error
chore: fix Streamlit deprecations and missing dependencies
Browse files- Suppressed
@st
.cache deprecation warning by adding suppress_st_warning=True parameter
- Replaced deprecated use_column_width parameter with use_container_width in image rendering
- Added altair>=4.0,<5.0 dependency to resolve ModuleNotFoundError for vegalite.v4
- Updated streamlit>=1.18.0 to ensure version compatibility with modern Streamlit features
- README.md +2 -2
- app.py +2 -2
- requirements.txt +14 -14
README.md
CHANGED
|
@@ -4,10 +4,10 @@ emoji: 🌖
|
|
| 4 |
colorFrom: blue
|
| 5 |
colorTo: blue
|
| 6 |
sdk: streamlit
|
| 7 |
-
sdk_version: 1.
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: apache-2.0
|
| 11 |
---
|
| 12 |
|
| 13 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 4 |
colorFrom: blue
|
| 5 |
colorTo: blue
|
| 6 |
sdk: streamlit
|
| 7 |
+
sdk_version: 1.52.1
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: apache-2.0
|
| 11 |
---
|
| 12 |
|
| 13 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
CHANGED
|
@@ -36,7 +36,7 @@ def draw_box(
|
|
| 36 |
)
|
| 37 |
|
| 38 |
|
| 39 |
-
@st.cache(allow_output_mutation=True,
|
| 40 |
def get_model(model_id : str = "yolov5s"):
|
| 41 |
model = torch.hub.load("ultralytics/yolov5", model_id)
|
| 42 |
return model
|
|
@@ -86,7 +86,7 @@ for _, obj in df.iterrows():
|
|
| 86 |
st.image(
|
| 87 |
np.array(pil_image),
|
| 88 |
caption=f"Processed image",
|
| 89 |
-
|
| 90 |
)
|
| 91 |
|
| 92 |
st.text(f"Time to inference: {round(time.time() - end_time, 2)} sec")
|
|
|
|
| 36 |
)
|
| 37 |
|
| 38 |
|
| 39 |
+
@st.cache(allow_output_mutation=True, suppress_st_warning=True)
|
| 40 |
def get_model(model_id : str = "yolov5s"):
|
| 41 |
model = torch.hub.load("ultralytics/yolov5", model_id)
|
| 42 |
return model
|
|
|
|
| 86 |
st.image(
|
| 87 |
np.array(pil_image),
|
| 88 |
caption=f"Processed image",
|
| 89 |
+
use_container_width=True,
|
| 90 |
)
|
| 91 |
|
| 92 |
st.text(f"Time to inference: {round(time.time() - end_time, 2)} sec")
|
requirements.txt
CHANGED
|
@@ -1,20 +1,20 @@
|
|
| 1 |
streamlit
|
| 2 |
pandas
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
matplotlib
|
| 6 |
-
numpy
|
| 7 |
-
opencv-python
|
| 8 |
-
Pillow
|
| 9 |
-
PyYAML
|
| 10 |
-
requests
|
| 11 |
-
scipy
|
| 12 |
-
torch
|
| 13 |
-
torchvision
|
| 14 |
-
tqdm
|
| 15 |
-
seaborn
|
| 16 |
|
| 17 |
# Extras --------------------------------------
|
| 18 |
ipython # interactive notebook
|
| 19 |
psutil # system utilization
|
| 20 |
-
thop
|
|
|
|
| 1 |
streamlit
|
| 2 |
pandas
|
| 3 |
+
altair>=4.0,<5.0
|
| 4 |
+
ultralytics
|
| 5 |
+
matplotlib
|
| 6 |
+
numpy
|
| 7 |
+
opencv-python
|
| 8 |
+
Pillow
|
| 9 |
+
PyYAML
|
| 10 |
+
requests
|
| 11 |
+
scipy
|
| 12 |
+
torch
|
| 13 |
+
torchvision
|
| 14 |
+
tqdm
|
| 15 |
+
seaborn
|
| 16 |
|
| 17 |
# Extras --------------------------------------
|
| 18 |
ipython # interactive notebook
|
| 19 |
psutil # system utilization
|
| 20 |
+
thop # FLOPs computation
|