Spaces:
Sleeping
Sleeping
Create summarizer.py
Browse files- summarizer.py +12 -0
summarizer.py
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from model import load_model
|
2 |
+
|
3 |
+
# Initialize the model
|
4 |
+
model = load_model()
|
5 |
+
|
6 |
+
def summarize_text(input_text: str) -> str:
|
7 |
+
"""
|
8 |
+
Summarize the input text using the pre-trained Hugging Face model.
|
9 |
+
"""
|
10 |
+
# Get the summary
|
11 |
+
summary = model(input_text, max_length=200, min_length=50, do_sample=False)
|
12 |
+
return summary[0]['summary_text']
|