Peijie commited on
Commit
d323ecd
1 Parent(s): 8f1674b

test strange bug in spaces

Browse files
Files changed (2) hide show
  1. app.py +2 -6
  2. requirements.txt +1 -1
app.py CHANGED
@@ -1,7 +1,6 @@
1
 
2
  import io
3
  import os
4
- debug = False
5
 
6
  import torch
7
  import json
@@ -17,7 +16,7 @@ from plots import get_pre_define_colors
17
  from utils.load_model import load_xclip
18
  from utils.predict import xclip_pred
19
 
20
-
21
  DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
22
  XCLIP, OWLVIT_PRECESSOR = load_xclip(DEVICE)
23
  XCLIP_DESC_PATH = "data/jsons/bs_cub_desc.json"
@@ -447,7 +446,4 @@ with gr.Blocks(theme=gr.themes.Soft(), css=custom_css, title="PEEB") as demo:
447
  xclip_edit_button.click(on_edit_button_click_xclip, inputs=[], outputs=[xclip_textbox, custom_explanation])
448
  xclip_predict_button.click(on_predict_button_click_xclip, inputs=[xclip_textbox], outputs=[xclip_textbox, xclip_pred_label, xclip_explanation, custom_pred_label, custom_explanation])
449
 
450
- if debug:
451
- demo.launch(server_port=5000, share=True)
452
- else:
453
- demo.launch()
 
1
 
2
  import io
3
  import os
 
4
 
5
  import torch
6
  import json
 
16
  from utils.load_model import load_xclip
17
  from utils.predict import xclip_pred
18
 
19
+ print(f"Gradio version {gr.__version__}")
20
  DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
21
  XCLIP, OWLVIT_PRECESSOR = load_xclip(DEVICE)
22
  XCLIP_DESC_PATH = "data/jsons/bs_cub_desc.json"
 
446
  xclip_edit_button.click(on_edit_button_click_xclip, inputs=[], outputs=[xclip_textbox, custom_explanation])
447
  xclip_predict_button.click(on_predict_button_click_xclip, inputs=[xclip_textbox], outputs=[xclip_textbox, xclip_pred_label, xclip_explanation, custom_pred_label, custom_explanation])
448
 
449
+ demo.launch()
 
 
 
requirements.txt CHANGED
@@ -1,6 +1,6 @@
1
  torch
2
  torchvision
3
- gradio
4
  numpy
5
  Pillow
6
  transformers
 
1
  torch
2
  torchvision
3
+ gradio==4.28.2
4
  numpy
5
  Pillow
6
  transformers