Spaces:
Sleeping
Sleeping
File size: 582 Bytes
97a1d26 d453e63 3af526a d453e63 97a1d26 d453e63 97a1d26 d453e63 97a1d26 d453e63 | 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 | from transformers import pipeline
import gradio as gr
# Use a specific model and CPU
model = pipeline(
"summarization",
model="facebook/bart-large-cnn",
device=-1 # forces CPU
)
def predict(prompt):
summary = model(prompt)[0]["summary_text"]
return summary
# Simple Gradio interface
demo = gr.Interface(
fn=predict,
inputs=gr.Textbox(placeholder="Enter text to summarize", lines=4),
outputs="text",
title="MLOps Pipeline Summarizer",
description="Enter text and get a summarized version using Hugging Face Transformers"
)
demo.launch()
|