harshinde commited on
Commit
f6b56a0
·
1 Parent(s): 5885827

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

Files changed (3) hide show
  1. README.md +2 -2
  2. app.py +2 -2
  3. 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.15.2
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, show_spinner=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
- use_column_width=True,
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
- # YOLOv5 requirements
5
- matplotlib>=3.2.2
6
- numpy>=1.18.5
7
- opencv-python>=4.1.1
8
- Pillow>=7.1.2
9
- PyYAML>=5.3.1
10
- requests>=2.23.0
11
- scipy>=1.4.1
12
- torch>=1.7.0
13
- torchvision>=0.8.1
14
- tqdm>=4.64.0
15
- seaborn>=0.11.0
16
 
17
  # Extras --------------------------------------
18
  ipython # interactive notebook
19
  psutil # system utilization
20
- thop>=0.1.1 # FLOPs computation
 
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