Spaces:
Runtime error
Runtime error
Uploaded Manually due to github not working
Browse files
README.md
CHANGED
@@ -23,4 +23,12 @@ I will not be using Docker for the purpose of this project so everything will be
|
|
23 |
|
24 |
Milestone-2:
|
25 |
The link below will take you to the hugging face space for the sentiment analysis web app
|
26 |
-
https://huggingface.co/spaces/MJ3128/CS-GY-6613-Project
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
Milestone-2:
|
25 |
The link below will take you to the hugging face space for the sentiment analysis web app
|
26 |
+
https://huggingface.co/spaces/MJ3128/CS-GY-6613-Project
|
27 |
+
|
28 |
+
Milestone-3:
|
29 |
+
The same link will take you to the viability page. The sentiment analysis code has be commented out for convenience.
|
30 |
+
https://huggingface.co/spaces/MJ3128/CS-GY-6613-Project
|
31 |
+
|
32 |
+
Milestone-4:
|
33 |
+
Landing page for the project, contains a video demo. Demo can also be found in the repository.
|
34 |
+
https://sites.google.com/nyu.edu/mj3128-ai-project/home
|
app.py
CHANGED
@@ -11,8 +11,9 @@ if "score" not in st.session_state:
|
|
11 |
|
12 |
|
13 |
def get_patent_score(pipeline, abstract, claims):
|
14 |
-
abstract_score = pipeline(
|
15 |
-
|
|
|
16 |
abstract_label = abstract_score[0]["label"]
|
17 |
claims_label = claims_score[0]["label"]
|
18 |
st.session_state.score = "{:.2f}".format(
|
@@ -21,7 +22,7 @@ def get_patent_score(pipeline, abstract, claims):
|
|
21 |
if abstract_label == claims_label:
|
22 |
st.session_state.viability = abstract_label
|
23 |
else:
|
24 |
-
if abstract_score[0]["score"] > claims_score[0]["
|
25 |
st.session_state.viability = abstract_label
|
26 |
else:
|
27 |
st.session_state.viability = claims_label
|
@@ -29,7 +30,8 @@ def get_patent_score(pipeline, abstract, claims):
|
|
29 |
|
30 |
checkpoint_file = "./checkpoint-3024"
|
31 |
model = AutoModelForSequenceClassification.from_pretrained(checkpoint_file)
|
32 |
-
tokenizer = AutoTokenizer.from_pretrained(
|
|
|
33 |
pipeline = pipeline("text-classification", model=model, tokenizer=tokenizer)
|
34 |
|
35 |
dataset_dict = load_dataset('HUPD/hupd',
|
@@ -70,6 +72,8 @@ st.button("Check Viability", on_click=get_patent_score,
|
|
70 |
st.markdown(body="Outcome: {}, Score: {}%".format(
|
71 |
st.session_state.viability, st.session_state.score))
|
72 |
|
|
|
|
|
73 |
# Milestone-2
|
74 |
# if "sentiment" not in st.session_state:
|
75 |
# st.session_state.sentiment = ""
|
|
|
11 |
|
12 |
|
13 |
def get_patent_score(pipeline, abstract, claims):
|
14 |
+
abstract_score = pipeline(
|
15 |
+
abstract, pad_to_max_length=True, truncation=True)
|
16 |
+
claims_score = pipeline(claims, pad_to_max_length=True, truncation=True)
|
17 |
abstract_label = abstract_score[0]["label"]
|
18 |
claims_label = claims_score[0]["label"]
|
19 |
st.session_state.score = "{:.2f}".format(
|
|
|
22 |
if abstract_label == claims_label:
|
23 |
st.session_state.viability = abstract_label
|
24 |
else:
|
25 |
+
if abstract_score[0]["score"] > claims_score[0]["score"]:
|
26 |
st.session_state.viability = abstract_label
|
27 |
else:
|
28 |
st.session_state.viability = claims_label
|
|
|
30 |
|
31 |
checkpoint_file = "./checkpoint-3024"
|
32 |
model = AutoModelForSequenceClassification.from_pretrained(checkpoint_file)
|
33 |
+
tokenizer = AutoTokenizer.from_pretrained(
|
34 |
+
checkpoint_file, pad_to_max_length=True)
|
35 |
pipeline = pipeline("text-classification", model=model, tokenizer=tokenizer)
|
36 |
|
37 |
dataset_dict = load_dataset('HUPD/hupd',
|
|
|
72 |
st.markdown(body="Outcome: {}, Score: {}%".format(
|
73 |
st.session_state.viability, st.session_state.score))
|
74 |
|
75 |
+
get_patent_score(pipeline=pipeline, abstract=abstract, claims=claims)
|
76 |
+
|
77 |
# Milestone-2
|
78 |
# if "sentiment" not in st.session_state:
|
79 |
# st.session_state.sentiment = ""
|