Spaces:
Build error
Build error
Download app.py from mozaloom/Text-Summarizer-HF: direct link, hf CLI and curl.
- Browser
- Download file 508 Bytes
-
https://huggingface.co/spaces/mozaloom/Text-Summarizer-HF/resolve/main/app.py
- Command line
-
hf download hf://spaces/mozaloom/Text-Summarizer-HF/app.py
-
curl -L -o app.py https://huggingface.co/spaces/mozaloom/Text-Summarizer-HF/resolve/main/app.py
508 Bytes
| from transformers import pipeline | |
| import gradio as gr | |
| model = pipeline("summarization") | |
| def predict(prompt): | |
| summary = model(prompt) | |
| return summary[0]['summary_text'] # or however you want to extract the summary | |
| with gr.Blocks() as demo: | |
| textbox = gr.Textbox(placeholder="Enter text block to summarize", lines=4) | |
| output = gr.Textbox(label="Summary") | |
| btn = gr.Button("Summarize") | |
| btn.click(fn=predict, inputs=textbox, outputs=output) | |
| demo.launch(share=True) | |