Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -9,6 +9,13 @@ from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
|
|
9 |
from nltk.tokenize import sent_tokenize
|
10 |
import torch
|
11 |
import pickle
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
# Initialize the embedding model
|
14 |
embedding_model = SentenceTransformer('all-MiniLM-L6-v2')
|
@@ -125,3 +132,6 @@ with gr.Blocks() as demo:
|
|
125 |
query_button.click(fn=process_and_query, inputs=[query], outputs=query_output)
|
126 |
|
127 |
demo.launch()
|
|
|
|
|
|
|
|
9 |
from nltk.tokenize import sent_tokenize
|
10 |
import torch
|
11 |
import pickle
|
12 |
+
import nltk
|
13 |
+
|
14 |
+
# Ensure NLTK resources are downloaded
|
15 |
+
try:
|
16 |
+
nltk.data.find('tokenizers/punkt')
|
17 |
+
except LookupError:
|
18 |
+
nltk.download('punkt')
|
19 |
|
20 |
# Initialize the embedding model
|
21 |
embedding_model = SentenceTransformer('all-MiniLM-L6-v2')
|
|
|
132 |
query_button.click(fn=process_and_query, inputs=[query], outputs=query_output)
|
133 |
|
134 |
demo.launch()
|
135 |
+
|
136 |
+
|
137 |
+
|