inam09 commited on
Commit
9a4dd9d
·
verified ·
1 Parent(s): 3cc8b6f

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +9 -2
src/streamlit_app.py CHANGED
@@ -16,11 +16,18 @@ import random
16
  import torch # Import torch
17
 
18
  # Download NLTK resources if not already downloaded
19
- nltk_data_dir = os.path.join(os.path.dirname(os.path.dirname(__file__)), "nltk_data")
 
 
 
 
 
20
  os.makedirs(nltk_data_dir, exist_ok=True)
21
- nltk.download('averaged_perceptron_tagger', download_dir=nltk_data_dir, quiet=True)
22
  nltk.data.path.append(nltk_data_dir)
23
 
 
 
 
24
  # Load models
25
  summarizer = pipeline("summarization", model="sshleifer/distilbart-cnn-12-6", device=torch.device("cpu"))
26
  qa_pipeline = pipeline("question-answering", model="distilbert-base-cased-distilled-squad", device=torch.device("cpu"))
 
16
  import torch # Import torch
17
 
18
  # Download NLTK resources if not already downloaded
19
+ # nltk_data_dir = os.path.join(os.path.dirname(os.path.dirname(__file__)), "nltk_data")
20
+ # os.makedirs(nltk_data_dir, exist_ok=True)
21
+ # nltk.download('averaged_perceptron_tagger', download_dir=nltk_data_dir, quiet=True)
22
+ # nltk.data.path.append(nltk_data_dir)
23
+
24
+ nltk_data_dir = "/tmp/nltk_data"
25
  os.makedirs(nltk_data_dir, exist_ok=True)
 
26
  nltk.data.path.append(nltk_data_dir)
27
 
28
+ # nltk.download('punkt', download_dir=nltk_data_dir)
29
+ nltk.download('averaged_perceptron_tagger', download_dir=nltk_data_dir)
30
+
31
  # Load models
32
  summarizer = pipeline("summarization", model="sshleifer/distilbart-cnn-12-6", device=torch.device("cpu"))
33
  qa_pipeline = pipeline("question-answering", model="distilbert-base-cased-distilled-squad", device=torch.device("cpu"))