Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -12,7 +12,12 @@ import textract
|
|
12 |
def load_summarization_pipeline():
|
13 |
try:
|
14 |
# Initialize the summarization pipeline using the specified model.
|
15 |
-
|
|
|
|
|
|
|
|
|
|
|
16 |
return summarizer
|
17 |
except Exception as e:
|
18 |
st.error(f"Error loading summarization model: {e}")
|
@@ -79,7 +84,7 @@ def summarize_text(text):
|
|
79 |
return "No text available to summarize."
|
80 |
|
81 |
try:
|
82 |
-
#
|
83 |
# For long documents, consider splitting the text into smaller chunks.
|
84 |
summary = summarizer(text, max_length=150, min_length=40, do_sample=False)
|
85 |
return summary[0]["summary_text"]
|
|
|
12 |
def load_summarization_pipeline():
|
13 |
try:
|
14 |
# Initialize the summarization pipeline using the specified model.
|
15 |
+
# Adding trust_remote_code=True allows loading models with custom code.
|
16 |
+
summarizer = pipeline(
|
17 |
+
"summarization",
|
18 |
+
model="deepseek-ai/deepseek-vl2-tiny",
|
19 |
+
trust_remote_code=True
|
20 |
+
)
|
21 |
return summarizer
|
22 |
except Exception as e:
|
23 |
st.error(f"Error loading summarization model: {e}")
|
|
|
84 |
return "No text available to summarize."
|
85 |
|
86 |
try:
|
87 |
+
# The summarization pipeline might have limitations on text length.
|
88 |
# For long documents, consider splitting the text into smaller chunks.
|
89 |
summary = summarizer(text, max_length=150, min_length=40, do_sample=False)
|
90 |
return summary[0]["summary_text"]
|