Benjamin S Liang commited on
Commit
284129c
1 Parent(s): 2d7ed25

Fix abstract list

Browse files
Files changed (2) hide show
  1. app.py +2 -2
  2. finetunehupd.ipynb +8 -0
app.py CHANGED
@@ -5,7 +5,6 @@ from transformers import pipeline, DistilBertForSequenceClassification, DistilBe
5
  MODEL_OPTS = ['finetuned', 'default', 'bertweet-base-sentiment-analysis', 'twitter-roberta-base', 'distilRoberta-financial-sentiment']
6
  FINETUNED_OPT = MODEL_OPTS[0]
7
  DEFAULT_OPT = MODEL_OPTS[1]
8
- abstracts = []
9
 
10
  # Helper function
11
  def map_decision_to_string(example):
@@ -21,8 +20,8 @@ def load_abstracts():
21
  val_filing_start_date='2016-01-01',
22
  val_filing_end_date='2016-01-01',
23
  )
24
- abstracts = dataset_dict['train']['abstract']
25
  dataset_dict = [] # free up space
 
26
 
27
  # returns loaded model and tokenizer, if any
28
  def load_model(opt):
@@ -59,6 +58,7 @@ def sentiment_analysis(model, tokenizer):
59
  st.title('Finetuned Harvard USPTO Patent Dataset (using DistilBert-Base-Uncased)')
60
  st.markdown('Link to the app - [sentiment-analysis-app](https://huggingface.co/spaces/saccharinedreams/sentiment-analysis-app)')
61
 
 
62
  dropdown_abstracts = st.selectbox('Select one of the following abstracts from the HUPD dataset:', abstracts, index=abstracts.index(abstracts[0]))
63
  model, tokenizer = load_model('finetuned')
64
 
 
5
  MODEL_OPTS = ['finetuned', 'default', 'bertweet-base-sentiment-analysis', 'twitter-roberta-base', 'distilRoberta-financial-sentiment']
6
  FINETUNED_OPT = MODEL_OPTS[0]
7
  DEFAULT_OPT = MODEL_OPTS[1]
 
8
 
9
  # Helper function
10
  def map_decision_to_string(example):
 
20
  val_filing_start_date='2016-01-01',
21
  val_filing_end_date='2016-01-01',
22
  )
 
23
  dataset_dict = [] # free up space
24
+ return dataset_dict['train']['abstract']
25
 
26
  # returns loaded model and tokenizer, if any
27
  def load_model(opt):
 
58
  st.title('Finetuned Harvard USPTO Patent Dataset (using DistilBert-Base-Uncased)')
59
  st.markdown('Link to the app - [sentiment-analysis-app](https://huggingface.co/spaces/saccharinedreams/sentiment-analysis-app)')
60
 
61
+ abstracts = load_abstracts()
62
  dropdown_abstracts = st.selectbox('Select one of the following abstracts from the HUPD dataset:', abstracts, index=abstracts.index(abstracts[0]))
63
  model, tokenizer = load_model('finetuned')
64
 
finetunehupd.ipynb CHANGED
@@ -1260,6 +1260,14 @@
1260
  "# model.eval()"
1261
  ]
1262
  },
 
 
 
 
 
 
 
 
1263
  {
1264
  "cell_type": "code",
1265
  "execution_count": 5,
 
1260
  "# model.eval()"
1261
  ]
1262
  },
1263
+ {
1264
+ "cell_type": "code",
1265
+ "execution_count": null,
1266
+ "id": "567bcfcd-cb0d-4f3e-98a3-51f5c6ed5d1d",
1267
+ "metadata": {},
1268
+ "outputs": [],
1269
+ "source": []
1270
+ },
1271
  {
1272
  "cell_type": "code",
1273
  "execution_count": 5,