Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -4,10 +4,11 @@ from transformers import pipeline
|
|
4 |
|
5 |
# Use a pipeline as a high-level helper
|
6 |
device = 0 if torch.cuda.is_available() else -1
|
7 |
-
text_summary = pipeline("summarization", model="Falconsai/text_summarization",device=device,torch_dtype=torch.bfloat16)
|
8 |
|
9 |
def summary(input):
|
10 |
-
|
|
|
11 |
return output[0]['summary_text']
|
12 |
|
13 |
gr.close_all()
|
@@ -22,3 +23,4 @@ demo = gr.Interface(
|
|
22 |
)
|
23 |
|
24 |
demo.launch()
|
|
|
|
4 |
|
5 |
# Use a pipeline as a high-level helper
|
6 |
device = 0 if torch.cuda.is_available() else -1
|
7 |
+
text_summary = pipeline("summarization", model="Falconsai/text_summarization", device=device, torch_dtype=torch.bfloat16)
|
8 |
|
9 |
def summary(input):
|
10 |
+
# Adjust max_length and min_length for better summarization
|
11 |
+
output = text_summary(input, max_length=200, min_length=50, truncation=True)
|
12 |
return output[0]['summary_text']
|
13 |
|
14 |
gr.close_all()
|
|
|
23 |
)
|
24 |
|
25 |
demo.launch()
|
26 |
+
|