Spaces:
Sleeping
Sleeping
File size: 705 Bytes
d6c533e 3e38e92 d6c533e 4492537 7635e33 d6c533e 3e38e92 d6c533e 3e38e92 d6c533e 3e38e92 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
import torch
import gradio as gr
# Use a pipeline as a high-level helper
from transformers import pipeline
# Initialize the summarization pipeline
pipe = pipeline("summarization", model="Falconsai/text_summarization")
# Define the summarize function
def summarize(input):
output = pipe(input)
return output[0]['summary_text']
# Define the Gradio interface
iface = gr.Interface(
fn=summarize,
inputs=gr.Textbox(lines=12, placeholder="Enter text to summarize here..."),
outputs="text",
title="Text Summarizer",
description="Enter a long piece of text, and the summarizer will provide a concise summary."
)
# Launch the interface
if __name__ == "__main__":
iface.launch()
|