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