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
|
@@ -28,9 +28,9 @@ print("Model Path:", model_path)
|
|
28 |
if not os.path.exists(model_path):
|
29 |
st.error(f"Model directory {model_path} does not exist or is incorrect.")
|
30 |
else:
|
31 |
-
# Load the tokenizer and model
|
32 |
-
tokenizer =
|
33 |
-
model =
|
34 |
|
35 |
# Create a summarization pipeline
|
36 |
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
|
|
|
28 |
if not os.path.exists(model_path):
|
29 |
st.error(f"Model directory {model_path} does not exist or is incorrect.")
|
30 |
else:
|
31 |
+
# Load the tokenizer and model from the extracted directory
|
32 |
+
tokenizer = BartTokenizer.from_pretrained(model_path)
|
33 |
+
model = BartForConditionalGeneration.from_pretrained(model_path)
|
34 |
|
35 |
# Create a summarization pipeline
|
36 |
summarizer = pipeline("summarization", model=model, tokenizer=tokenizer)
|