Spaces:
Runtime error
Runtime error
ariana sutanto
commited on
Commit
·
b60d96b
1
Parent(s):
6a30585
message
Browse files
app.py
CHANGED
|
@@ -22,13 +22,7 @@ claims={}
|
|
| 22 |
|
| 23 |
|
| 24 |
dataset = dataset_dict["train"].shuffle(seed=42).select(range(20))
|
| 25 |
-
|
| 26 |
-
print(dataset[0])
|
| 27 |
-
|
| 28 |
-
for i in range(0, 20):
|
| 29 |
-
print(dataset['patent_number'][i])
|
| 30 |
-
print(dataset['decision'][i])
|
| 31 |
-
|
| 32 |
|
| 33 |
for i in range(0, 20):
|
| 34 |
|
|
@@ -46,15 +40,10 @@ def get_score(abstract):
|
|
| 46 |
with torch.no_grad():
|
| 47 |
logits = model(**inputs).logits
|
| 48 |
|
| 49 |
-
predictions = F.softmax(logits, dim=1)
|
| 50 |
-
|
| 51 |
-
accept_prob = probs[0].item()
|
| 52 |
-
#idk = torch.argmax(predictions)
|
| 53 |
-
print(predictions)
|
| 54 |
-
print(accept_prob)
|
| 55 |
|
| 56 |
-
|
| 57 |
-
return logits
|
| 58 |
|
| 59 |
|
| 60 |
|
|
@@ -63,8 +52,8 @@ patent_num = st.selectbox("Choose a patent number", options=abstracts.keys())
|
|
| 63 |
if st.button("Submit"):
|
| 64 |
abstract = st.text_area(label="Abstract",value=abstracts[patent_num])
|
| 65 |
claim = st.text_area(label="Claims",value=claims[patent_num])
|
| 66 |
-
|
| 67 |
-
st.write(
|
| 68 |
|
| 69 |
|
| 70 |
|
|
|
|
| 22 |
|
| 23 |
|
| 24 |
dataset = dataset_dict["train"].shuffle(seed=42).select(range(20))
|
| 25 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
for i in range(0, 20):
|
| 28 |
|
|
|
|
| 40 |
with torch.no_grad():
|
| 41 |
logits = model(**inputs).logits
|
| 42 |
|
| 43 |
+
predictions = F.softmax(logits, dim=1) #will get the probabilities of each label 0 and 1
|
| 44 |
+
score = predictions[1] #get the probability of the label being 1 (patent accepted)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
|
| 46 |
+
return score
|
|
|
|
| 47 |
|
| 48 |
|
| 49 |
|
|
|
|
| 52 |
if st.button("Submit"):
|
| 53 |
abstract = st.text_area(label="Abstract",value=abstracts[patent_num])
|
| 54 |
claim = st.text_area(label="Claims",value=claims[patent_num])
|
| 55 |
+
patentability= get_score(abstract)
|
| 56 |
+
st.write(f"The patentability score is: {patentability}")
|
| 57 |
|
| 58 |
|
| 59 |
|