khanfou
commited on
Commit
•
29b2491
1
Parent(s):
63f5e17
Update app.py
Browse files
app.py
CHANGED
@@ -2,8 +2,11 @@ import streamlit as st
|
|
2 |
from datasets import load_dataset
|
3 |
from transformers import pipeline
|
4 |
import pandas as pd
|
5 |
-
|
|
|
|
|
6 |
from datasets import load_dataset
|
|
|
7 |
dataset_dict = load_dataset('HUPD/hupd',
|
8 |
name='sample',
|
9 |
data_files="https://huggingface.co/datasets/HUPD/hupd/blob/main/hupd_metadata_2022-02-22.feather",
|
@@ -30,10 +33,17 @@ with st.form("patent-form"):
|
|
30 |
|
31 |
if submitted:
|
32 |
#st.write("Outside the form")
|
33 |
-
|
34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
score = result['score']
|
36 |
st.write("The Patentability Score is:", score)
|
|
|
37 |
|
38 |
######NEW
|
39 |
|
|
|
2 |
from datasets import load_dataset
|
3 |
from transformers import pipeline
|
4 |
import pandas as pd
|
5 |
+
import torch
|
6 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification, pipeline
|
7 |
+
from sklearn.model_selection import train_test_split
|
8 |
from datasets import load_dataset
|
9 |
+
|
10 |
dataset_dict = load_dataset('HUPD/hupd',
|
11 |
name='sample',
|
12 |
data_files="https://huggingface.co/datasets/HUPD/hupd/blob/main/hupd_metadata_2022-02-22.feather",
|
|
|
33 |
|
34 |
if submitted:
|
35 |
#st.write("Outside the form")
|
36 |
+
model_name = "distilbert-base-uncased-finetuned-sst-2-english"
|
37 |
+
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
38 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
39 |
+
classifier = pipeline("sentiment-analysis", model=model, tokenizer=tokenizer)
|
40 |
+
abstract = df['abstract'].loc[df['patent_number'] == make_choice]
|
41 |
+
X_train = abstract.values.tolist()
|
42 |
+
results = classifier(X_train, truncation=True)
|
43 |
+
#result = hupd_model(make_choice)[0]
|
44 |
score = result['score']
|
45 |
st.write("The Patentability Score is:", score)
|
46 |
+
|
47 |
|
48 |
######NEW
|
49 |
|