mike23415 commited on
Commit
17c487a
·
verified ·
1 Parent(s): 0116c46

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -1,6 +1,10 @@
 
1
  from transformers import pipeline
2
 
3
- summarizer = pipeline("summarization", model="t5-base")
 
 
 
4
 
5
  text = "This is a long text that needs summarization."
6
 
 
1
+ import torch
2
  from transformers import pipeline
3
 
4
+ # Force the model to use CPU explicitly
5
+ device = torch.device("cpu")
6
+
7
+ summarizer = pipeline("summarization", model="t5-base", device=-1) # -1 ensures CPU usage
8
 
9
  text = "This is a long text that needs summarization."
10