Spaces:
Runtime error
Runtime error
Download app.py from ghudeihed/summarization: direct link, hf CLI and curl.
- Browser
- Download file 673 Bytes
-
https://huggingface.co/spaces/ghudeihed/summarization/resolve/main/app.py
- Command line
-
hf download hf://spaces/ghudeihed/summarization/app.py
-
curl -L -o app.py https://huggingface.co/spaces/ghudeihed/summarization/resolve/main/app.py
673 Bytes
| import gradio as gr | |
| from transformers import pipeline | |
| task = 'summarization' | |
| model = 'sshleifer/distilbart-cnn-12-6' | |
| get_completion = pipeline(task=task, model=model) | |
| def summarize(input): | |
| output = get_completion(input) | |
| return output[0]['summary_text'] | |
| result = gr.Interface(fn=summarize, | |
| inputs=[gr.TextArea(label='Text to summerize:')], | |
| outputs=gr.TextArea(label='Summary'), | |
| title='Text summerization with distilbart-cnn', | |
| description="Summerize any text using `sshleifer/distilbart-cnn-12-6` model under the hood!" | |
| ) | |
| result.launch(inline=False, share=True) |