Spaces:
Sleeping
Sleeping
Commit ·
1f8e203
1
Parent(s): 8990b8a
Add application file
Browse files- app.py +12 -0
- requirements.txt +2 -1
app.py
CHANGED
|
@@ -16,6 +16,18 @@ from langchain_community.llms.huggingface_pipeline import HuggingFacePipeline
|
|
| 16 |
from transformers import TextIteratorStreamer
|
| 17 |
from threading import Thread
|
| 18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
# Prompt template
|
| 20 |
template = """Instruction:
|
| 21 |
You are an AI assistant for answering questions about the provided context.
|
|
|
|
| 16 |
from transformers import TextIteratorStreamer
|
| 17 |
from threading import Thread
|
| 18 |
|
| 19 |
+
# Download required NLTK data
|
| 20 |
+
import nltk
|
| 21 |
+
try:
|
| 22 |
+
nltk.data.find('tokenizers/punkt_tab')
|
| 23 |
+
except LookupError:
|
| 24 |
+
nltk.download('punkt_tab')
|
| 25 |
+
|
| 26 |
+
try:
|
| 27 |
+
nltk.data.find('tokenizers/punkt')
|
| 28 |
+
except LookupError:
|
| 29 |
+
nltk.download('punkt')
|
| 30 |
+
|
| 31 |
# Prompt template
|
| 32 |
template = """Instruction:
|
| 33 |
You are an AI assistant for answering questions about the provided context.
|
requirements.txt
CHANGED
|
@@ -8,4 +8,5 @@ langchain==0.1.1
|
|
| 8 |
langchain-community==0.0.13
|
| 9 |
unstructured==0.12.2
|
| 10 |
huggingface_hub>=0.20.0
|
| 11 |
-
gradio
|
|
|
|
|
|
| 8 |
langchain-community==0.0.13
|
| 9 |
unstructured==0.12.2
|
| 10 |
huggingface_hub>=0.20.0
|
| 11 |
+
gradio
|
| 12 |
+
nltk
|