Vivian commited on
Commit
fcf1637
·
1 Parent(s): e34de06
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -63,13 +63,6 @@ def main():
63
 
64
  st.header("Try it out!")
65
 
66
- MODEL = "vivianhuang88/bert_twitter_hashtag"
67
- print(MODEL)
68
- fill_mask = pipeline("fill-mask", model=MODEL, tokenizer=MODEL)
69
- print(fill_mask)
70
- tokenizer = BertTokenizer.from_pretrained(MODEL, additional_special_tokens=trending_topics)
71
- print(tokenizer)
72
-
73
  texts = ['Bruce has an electric guitar set in [MASK]. ', \
74
  'The Batman: Genesis special feature is a must watch. [MASK] '\
75
  'I don’t understand the need to exaggerate [MASK] Michelle Obama’s facial expressions. ', \
@@ -77,6 +70,13 @@ def main():
77
  "Evans Chebet ran mile 22 in 4 minutes and 27 seconds to take the men's [MASK] crown 💨"]
78
 
79
  selected_text = st.selectbox('Select a text',(texts))
 
 
 
 
 
 
 
80
  candidates = fill_mask(selected_text, targets = trending_topics)
81
  print(candidates)
82
  hashtags = get_hashtags(selected_text, candidates, tokenizer)
 
63
 
64
  st.header("Try it out!")
65
 
 
 
 
 
 
 
 
66
  texts = ['Bruce has an electric guitar set in [MASK]. ', \
67
  'The Batman: Genesis special feature is a must watch. [MASK] '\
68
  'I don’t understand the need to exaggerate [MASK] Michelle Obama’s facial expressions. ', \
 
70
  "Evans Chebet ran mile 22 in 4 minutes and 27 seconds to take the men's [MASK] crown 💨"]
71
 
72
  selected_text = st.selectbox('Select a text',(texts))
73
+
74
+ MODEL = "vivianhuang88/bert_twitter_hashtag"
75
+ print(MODEL)
76
+ fill_mask = pipeline("fill-mask", model=MODEL, tokenizer=MODEL)
77
+ print(fill_mask)
78
+ tokenizer = BertTokenizer.from_pretrained(MODEL, additional_special_tokens=trending_topics)
79
+ print(tokenizer)
80
  candidates = fill_mask(selected_text, targets = trending_topics)
81
  print(candidates)
82
  hashtags = get_hashtags(selected_text, candidates, tokenizer)