Spaces:
Sleeping
Sleeping
File size: 563 Bytes
9fd7d89 7507a36 524f780 9fd7d89 17c487a 9fd7d89 e116825 9fd7d89 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
import os
from transformers import pipeline
# Ensure HF doesn't request a token
os.environ["HF_HOME"] = "/app/cache"
os.environ["HF_HUB_DISABLE_SYMLINKS_WARNING"] = "1"
os.environ["HF_HUB_DISABLE_TELEMETRY"] = "1"
os.environ["HF_HUB_OFFLINE"] = "0"
# Load model
summarizer = pipeline("summarization", model="t5-base")
# Ensure script runs properly
if __name__ == "__main__":
print("Application started successfully!")
result = summarizer("This is a long text that needs summarization.", max_length=50, min_length=10, do_sample=False)
print(result)
|