juliaannjose commited on
Commit
9bcd196
·
1 Parent(s): 8fa6c01

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -9
app.py CHANGED
@@ -10,7 +10,7 @@ language_model_path = "juliaannjose/finetuned_model"
10
 
11
  # load the dataset to
12
  # use the patent number, abstract and claim columns for UI
13
- with st.spinner("Setting up the app..."):
14
  dataset_dict = load_dataset(
15
  "HUPD/hupd",
16
  name="sample",
@@ -36,17 +36,16 @@ _patent_id = st.selectbox(
36
  # display abstract and claim
37
  def get_abs_claim(_pid):
38
  # get abstract and claim corresponding to this patent id
39
- st.write(_pid)
40
- _abs = df.loc["patent_number" == _pid]["abstract"]
41
- _cl = df.loc["patent_number" == _pid]["claims"]
42
- st.write(_abs)
43
- return _abs, _cl
44
 
45
 
46
- st.write(_patent_id)
47
  _abstract, _claim = get_abs_claim(_patent_id)
48
- # st.write(_abstract) # display abstract
49
- # st.write(_claim) # display claims
 
 
50
 
51
 
52
  # model and tokenizer initialization
@@ -77,4 +76,5 @@ if st.button("Submit"):
77
 
78
  predicted_class_id = logits.argmax().item()
79
  pred_label = id2label[predicted_class_id]
 
80
  st.write(pred_label)
 
10
 
11
  # load the dataset to
12
  # use the patent number, abstract and claim columns for UI
13
+ with st.spinner("Loading..."):
14
  dataset_dict = load_dataset(
15
  "HUPD/hupd",
16
  name="sample",
 
36
  # display abstract and claim
37
  def get_abs_claim(_pid):
38
  # get abstract and claim corresponding to this patent id
39
+ _abs = df.loc[df["patent_number"] == _pid]["abstract"]
40
+ _cl = df.loc[df["patent_number"] == _pid]["claims"]
41
+ return _abs.values[0], _cl.values[0]
 
 
42
 
43
 
 
44
  _abstract, _claim = get_abs_claim(_patent_id)
45
+ st.title("Abstract:") # display abstract
46
+ st.write(_abstract)
47
+ st.title("Claim:") # display claims
48
+ st.write(_claim)
49
 
50
 
51
  # model and tokenizer initialization
 
76
 
77
  predicted_class_id = logits.argmax().item()
78
  pred_label = id2label[predicted_class_id]
79
+ st.title("Predicted Patentability")
80
  st.write(pred_label)