Spaces:
Sleeping
Sleeping
import gradio as gr | |
from transformers import pipeline | |
# Initialize the summarization pipeline with a specified model | |
pipe = pipeline("summarization", model="t5-small") | |
# Define a function for the summarization | |
def summarize(text): | |
return pipe(text)[0]['summary_text'] | |
# Create a Gradio interface | |
interface = gr.Interface( | |
fn=summarize, | |
inputs="text", | |
outputs="text", | |
title="Summarize Lengthy Texts - M Fahad Bashir ", | |
description="Enter text to t a summary." | |
) | |
# Launch the interface | |
interface.launch(share=True) | |