Spaces:
Build error
Build error
Download app.py from cs-uche/Text_Summarizer: direct link, hf CLI and curl.
- Browser
- Download file 570 Bytes
-
https://huggingface.co/spaces/cs-uche/Text_Summarizer/resolve/main/app.py
- Command line
-
hf download hf://spaces/cs-uche/Text_Summarizer/app.py
-
curl -L -o app.py https://huggingface.co/spaces/cs-uche/Text_Summarizer/resolve/main/app.py
570 Bytes
| from transformers import pipeline | |
| import gradio as gr | |
| summarizer = pipeline("summarization", model="t5-base", tokenizer="t5-small", truncation=True, framework="tf") | |
| def translate(text): | |
| text = text.replace(""", '"') | |
| text = text.replace("'", "'") | |
| text = text.replace("&", "&") | |
| result = summarizer(text, min_length=180, truncation=True) | |
| return result[0]["summary_text"] | |
| iface = gr.Interface( | |
| fn=translate, | |
| inputs=gr.Textbox(lines=10, placeholder="Enter text to summarize..."), | |
| outputs="text" | |
| ) | |
| iface.launch() |