Spaces:
Sleeping
Sleeping
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) | |