fcakyon commited on
Commit
8f4308c
1 Parent(s): c7bbfb5

load model and config files from hub

Browse files
Files changed (1) hide show
  1. app.py +10 -7
app.py CHANGED
@@ -7,7 +7,10 @@ import random
7
  from utils import sahi_mmdet_inference
8
  from streamlit_image_comparison import image_comparison
9
 
10
- MMDET_YOLOX_MODEL_URL = "https://download.openmmlab.com/mmdetection/v2.0/yolox/yolox_tiny_8x8_300e_coco/yolox_tiny_8x8_300e_coco_20211124_171234-b4047906.pth"
 
 
 
11
 
12
  IMAGE_TO_URL = {
13
  "apple_tree.jpg": "https://user-images.githubusercontent.com/34196005/142730935-2ace3999-a47b-49bb-83e0-2bdd509f1c90.jpg",
@@ -33,13 +36,13 @@ def download_comparison_images():
33
 
34
  @st.cache(allow_output_mutation=True, show_spinner=False)
35
  def get_model():
36
- model_path = "yolox.pt"
37
- sahi.utils.file.download_from_url(
38
- MMDET_YOLOX_MODEL_URL,
39
- model_path,
40
  )
41
- config_path = sahi.utils.mmdet.download_mmdet_config(
42
- model_name="yolox", config_file_name="yolox_tiny_8x8_300e_coco.py"
 
43
  )
44
 
45
  detection_model = AutoDetectionModel.from_pretrained(
7
  from utils import sahi_mmdet_inference
8
  from streamlit_image_comparison import image_comparison
9
 
10
+ MMDET_YOLOX_TINY_MODEL_URL = "https://huggingface.co/fcakyon/mmdet-yolox-tiny/resolve/main/yolox_tiny_8x8_300e_coco_20211124_171234-b4047906.pth"
11
+ MMDET_YOLOX_TINY_MODEL_PATH = "yolox.pt"
12
+ MMDET_YOLOX_TINY_CONFIG_URL = "https://huggingface.co/fcakyon/mmdet-yolox-tiny/raw/main/yolox_tiny_8x8_300e_coco.py"
13
+ MMDET_YOLOX_TINY_CONFIG_PATH = "config.py"
14
 
15
  IMAGE_TO_URL = {
16
  "apple_tree.jpg": "https://user-images.githubusercontent.com/34196005/142730935-2ace3999-a47b-49bb-83e0-2bdd509f1c90.jpg",
36
 
37
  @st.cache(allow_output_mutation=True, show_spinner=False)
38
  def get_model():
39
+ sahi.utils.file.download_from_url(
40
+ MMDET_YOLOX_TINY_MODEL_URL,
41
+ MMDET_YOLOX_TINY_MODEL_PATH,
 
42
  )
43
+ sahi.utils.file.download_from_url(
44
+ MMDET_YOLOX_TINY_CONFIG_URL,
45
+ MMDET_YOLOX_TINY_CONFIG_PATH,
46
  )
47
 
48
  detection_model = AutoDetectionModel.from_pretrained(