vives commited on
Commit
3abc396
·
1 Parent(s): 0b48aba

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -3
app.py CHANGED
@@ -7,9 +7,16 @@ import pickle
7
  import numpy as np
8
  import itertools
9
 
10
- model_checkpoint = "vives/distilbert-base-uncased-finetuned-cvent-2019_2022"
11
- model = AutoModelForMaskedLM.from_pretrained(model_checkpoint, output_hidden_states=True)
12
- tokenizer = AutoTokenizer.from_pretrained(model_checkpoint)
 
 
 
 
 
 
 
13
  text = st.text_input("Enter word or key-phrase")
14
 
15
  exclude_words = st.radio("exclude_words",[True,False], help="Exclude results that contain any words in the query (i.e exclude 'hot coffee' if the query is 'cold coffee')")
 
7
  import numpy as np
8
  import itertools
9
 
10
+ choice = st.radio("Choose model",["distilbert-cvent","finbert"])
11
+ if choice == "distilbert-cvent":
12
+ model_checkpoint = "vives/distilbert-base-uncased-finetuned-cvent-2019_2022"
13
+ model = AutoModelForMaskedLM.from_pretrained(model_checkpoint, output_hidden_states=True)
14
+ tokenizer = AutoTokenizer.from_pretrained(model_checkpoint)
15
+ else if choice == "finbert":
16
+ model_checkpoint = "ProsusAI/finbert"
17
+ tokenizer = AutoTokenizer.from_pretrained("ProsusAI/finbert")
18
+ model = AutoModelForSequenceClassification.from_pretrained("ProsusAI/finbert", output_hidden_states=True)
19
+
20
  text = st.text_input("Enter word or key-phrase")
21
 
22
  exclude_words = st.radio("exclude_words",[True,False], help="Exclude results that contain any words in the query (i.e exclude 'hot coffee' if the query is 'cold coffee')")