Peijie commited on
Commit
a5ea546
1 Parent(s): d323ecd

add force gradio version

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -1,6 +1,11 @@
 
 
 
 
 
 
1
 
2
  import io
3
- import os
4
 
5
  import torch
6
  import json
@@ -8,7 +13,6 @@ import base64
8
  import random
9
  import numpy as np
10
  import pandas as pd
11
- import gradio as gr
12
  from pathlib import Path
13
  from PIL import Image
14
 
@@ -16,7 +20,6 @@ from plots import get_pre_define_colors
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"
 
1
+ import os
2
+ import gradio as gr
3
+ print(f"Gradio version {gr.__version__}")
4
+ if gr.__version__ != '4.28.2':
5
+ os.system("pip install gradio==4.28.2")
6
+ print(f"Gradio version: {gr.__version__}")
7
 
8
  import io
 
9
 
10
  import torch
11
  import json
 
13
  import random
14
  import numpy as np
15
  import pandas as pd
 
16
  from pathlib import Path
17
  from PIL import Image
18
 
 
20
  from utils.load_model import load_xclip
21
  from utils.predict import xclip_pred
22
 
 
23
  DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
24
  XCLIP, OWLVIT_PRECESSOR = load_xclip(DEVICE)
25
  XCLIP_DESC_PATH = "data/jsons/bs_cub_desc.json"