jbraha commited on
Commit
9d3ef8a
·
1 Parent(s): cf0dd84

'mint autosave'

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -13,11 +13,13 @@ def analyze(input, model):
13
  #text insert
14
  input = st.text_area("insert text to be analyzed", value="Nice to see you today.", height=None, max_chars=None, key=None, help=None, on_change=None, args=None, kwargs=None, placeholder=None, disabled=False, label_visibility="visible")
15
  model_name = st.text_input("choose a transformer model", value="")
 
 
 
 
16
 
17
- model = TFAutoModelForSequenceClassification.from_pretrained(model_name)
18
- tokenizer = AutoTokenizer.from_pretrained(model_name)
19
-
20
- classifier = pipeline('sentiment-analysis', model=model, tokenizer=tokenizer)
21
 
22
 
23
  if st.button('Analyze'):
 
13
  #text insert
14
  input = st.text_area("insert text to be analyzed", value="Nice to see you today.", height=None, max_chars=None, key=None, help=None, on_change=None, args=None, kwargs=None, placeholder=None, disabled=False, label_visibility="visible")
15
  model_name = st.text_input("choose a transformer model", value="")
16
+ if model_name:
17
+ model = TFAutoModelForSequenceClassification.from_pretrained(model_name)
18
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
19
+ classifier = pipeline('sentiment-analysis', model=model, tokenizer=tokenizer)
20
 
21
+ else:
22
+ classifier = pipeline('sentiment-analysis')
 
 
23
 
24
 
25
  if st.button('Analyze'):