Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
-
from transformers import
|
| 3 |
import zipfile
|
| 4 |
import os
|
| 5 |
import nltk
|
|
@@ -31,8 +31,8 @@ if not os.path.exists(model_path):
|
|
| 31 |
# print("Contents of model_dir:", os.listdir(model_dir))
|
| 32 |
else:
|
| 33 |
# Load the tokenizer and model from the extracted directory
|
| 34 |
-
tokenizer =
|
| 35 |
-
model =
|
| 36 |
|
| 37 |
# Create a summarization pipeline
|
| 38 |
summarizer = pipeline("summarization", model=model, tokenizer=tokenizer)
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
+
from transformers import BartTokenizer, BartForConditionalGeneration, pipeline
|
| 3 |
import zipfile
|
| 4 |
import os
|
| 5 |
import nltk
|
|
|
|
| 31 |
# print("Contents of model_dir:", os.listdir(model_dir))
|
| 32 |
else:
|
| 33 |
# Load the tokenizer and model from the extracted directory
|
| 34 |
+
tokenizer = BartTokenizer.from_pretrained(model_path)
|
| 35 |
+
model = BartForConditionalGeneration.from_pretrained(model_path)
|
| 36 |
|
| 37 |
# Create a summarization pipeline
|
| 38 |
summarizer = pipeline("summarization", model=model, tokenizer=tokenizer)
|