Spaces:
Runtime error
Runtime error
scholarly360
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -15,7 +15,9 @@ from langchain.embeddings import HuggingFaceEmbeddings
|
|
15 |
from setfit import SetFitModel
|
16 |
# Download from the 🤗 Hub
|
17 |
clause_model = SetFitModel.from_pretrained("scholarly360/setfit-contracts-clauses")
|
18 |
-
|
|
|
|
|
19 |
|
20 |
def split_into_sentences_with_offsets(text):
|
21 |
"""
|
@@ -155,8 +157,8 @@ with st.form("my_form"):
|
|
155 |
for passage_document in passage_documents:
|
156 |
text = passage_document.page_content
|
157 |
metadata = passage_document.metadata
|
158 |
-
preds =
|
159 |
my_list_structure.append({"text": text, "metadata": metadata,"preds":preds })
|
160 |
|
161 |
-
|
162 |
-
|
|
|
15 |
from setfit import SetFitModel
|
16 |
# Download from the 🤗 Hub
|
17 |
clause_model = SetFitModel.from_pretrained("scholarly360/setfit-contracts-clauses")
|
18 |
+
import spacy
|
19 |
+
# Load the English model from SpaCy
|
20 |
+
nlp = spacy.load("en_core_web_md")
|
21 |
|
22 |
def split_into_sentences_with_offsets(text):
|
23 |
"""
|
|
|
157 |
for passage_document in passage_documents:
|
158 |
text = passage_document.page_content
|
159 |
metadata = passage_document.metadata
|
160 |
+
preds = clause_model(text)
|
161 |
my_list_structure.append({"text": text, "metadata": metadata,"preds":preds })
|
162 |
|
163 |
+
df = pd.DataFrame(my_list_structure)
|
164 |
+
df
|