Spaces:
Sleeping
Sleeping
File size: 802 Bytes
d1f6f7b 2bfcd91 d1f6f7b 2bfcd91 d1f6f7b 2bfcd91 d1f6f7b 2bfcd91 d1f6f7b 2bfcd91 d1f6f7b 2bfcd91 d1f6f7b |
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 27 |
import gradio as gr
from transformers import pipeline
pipe = pipeline("summarization", model="Manish014/review-summariser-gpt-config1")
def summarize(text):
if not text.strip():
return "Please enter a review."
return pipe(text)[0]["summary_text"]
example_reviews = [
["This product leaks water and smells like burnt plastic."],
["Absolutely loved the screen resolution and battery life."],
["Worst purchase I've made. Do not recommend at all."]
]
demo = gr.Interface(
fn=summarize,
inputs=gr.Textbox(lines=5, placeholder="Enter product review..."),
outputs=gr.Textbox(label="Summary"),
examples=example_reviews,
title="Review Summariser GPT - Config 1",
description="Enter a long product review and get a helpful short summary."
)
demo.launch()
|