huyingfan commited on
Commit
21bd41f
1 Parent(s): 7043da7
Files changed (2) hide show
  1. app.py +7 -2
  2. requirements.txt +1 -0
app.py CHANGED
@@ -68,7 +68,7 @@ def get_model(model_name, pretrained=True):
68
  cached_path = f'cache/{model_name}_prototype.pt' # noqa
69
  cfg.model.prototype = cached_path
70
 
71
- model = init_model(metainfo.config, None, device='cuda')
72
  with st.spinner(f'Loading model {model_name} on the server...This is '
73
  'slow at the first time.'):
74
  model.init_weights()
@@ -133,9 +133,14 @@ def app():
133
  model_name = st.sidebar.selectbox("Model:", ['resnet50_8xb32_in1k'])
134
 
135
  st.markdown(
136
- "<h1 style='text-align: center;'>Image To Image Retrieval</h1>",
137
  unsafe_allow_html=True,
138
  )
 
 
 
 
 
139
 
140
  file = st.file_uploader(
141
  'Please upload your own image or use the provided:')
 
68
  cached_path = f'cache/{model_name}_prototype.pt' # noqa
69
  cfg.model.prototype = cached_path
70
 
71
+ model = init_model(metainfo.config, None, device='cpu')
72
  with st.spinner(f'Loading model {model_name} on the server...This is '
73
  'slow at the first time.'):
74
  model.init_weights()
 
133
  model_name = st.sidebar.selectbox("Model:", ['resnet50_8xb32_in1k'])
134
 
135
  st.markdown(
136
+ "<h1>Image To Image Retrieval</h1>",
137
  unsafe_allow_html=True,
138
  )
139
+ st.write(
140
+ 'This is a demo for image to image retrieval in around 3k images from '
141
+ 'ImageNet tiny val set using mmclassification apis. You can try more '
142
+ 'features on [mmclassification]'
143
+ '(https://github.com/open-mmlab/mmclassification).')
144
 
145
  file = st.file_uploader(
146
  'Please upload your own image or use the provided:')
requirements.txt CHANGED
@@ -1,4 +1,5 @@
1
  torch
 
2
  mmengine>=0.4.0
3
  mmcls>=1.0.0rc5
4
  mmcv>=2.0.0rc3
 
1
  torch
2
+ torchvision
3
  mmengine>=0.4.0
4
  mmcls>=1.0.0rc5
5
  mmcv>=2.0.0rc3