from transformers import pipeline import gradio as gr # Define the summarizer using the transformers pipeline summarizer = pipeline("summarization", model="google-t5/t5-small", tokenizer="google-t5/t5-small", truncation=True, framework="tf") # Define the function to process the text and return the summary 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'] # Create the Gradio interface with updated syntax iface = gr.Interface( fn=translate, inputs=gr.Textbox(lines=10, placeholder="Enter text to summarize..."), outputs=gr.Textbox() ) # Launch the Gradio app iface.launch()