shpotes commited on
Commit
a46f695
·
1 Parent(s): fed60af
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -13,6 +13,8 @@ LOCAL_PATH = snapshot_download("flax-community/medclip")
13
  sys.path.append(LOCAL_PATH)
14
 
15
  from src.modeling_medclip import FlaxMedCLIP
 
 
16
 
17
  def prepare_image(image_path, model):
18
  image = read_image(image_path, mode=ImageReadMode.RGB)
@@ -33,14 +35,14 @@ def save_file_to_disk(uplaoded_file):
33
  @st.cache(
34
  hash_funcs={
35
  transformers.models.roberta.tokenization_roberta_fast.RobertaTokenizerFast: id,
36
- FlaxHybridCLIP: id,
37
  },
38
  show_spinner=False
39
  )
40
  def load_tokenizer_and_model():
41
  # load the saved model
42
  tokenizer = AutoTokenizer.from_pretrained("allenai/scibert_scivocab_uncased")
43
- model = FlaxHybridCLIP.from_pretrained(LOCAL_PATH)
44
  return tokenizer, model
45
 
46
  def run_inference(image_path, text, model, tokenizer):
 
13
  sys.path.append(LOCAL_PATH)
14
 
15
  from src.modeling_medclip import FlaxMedCLIP
16
+ from run_medclip import Transform
17
+
18
 
19
  def prepare_image(image_path, model):
20
  image = read_image(image_path, mode=ImageReadMode.RGB)
 
35
  @st.cache(
36
  hash_funcs={
37
  transformers.models.roberta.tokenization_roberta_fast.RobertaTokenizerFast: id,
38
+ FlaxMedCLIP: id,
39
  },
40
  show_spinner=False
41
  )
42
  def load_tokenizer_and_model():
43
  # load the saved model
44
  tokenizer = AutoTokenizer.from_pretrained("allenai/scibert_scivocab_uncased")
45
+ model = FlaxMedCLIP.from_pretrained(LOCAL_PATH)
46
  return tokenizer, model
47
 
48
  def run_inference(image_path, text, model, tokenizer):