Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
# Load the summarization pipeline
|
5 |
+
pipe = pipeline("summarization", model="yashugupta786/bart_large_xsum_samsum_conv_summarizer")
|
6 |
+
|
7 |
+
# Summarization function
|
8 |
+
def summarize(text):
|
9 |
+
summary = pipe(text)
|
10 |
+
return summary[0]['summary_text']
|
11 |
+
|
12 |
+
# Gradio interface
|
13 |
+
with gr.Blocks() as demo:
|
14 |
+
gr.Interface(
|
15 |
+
fn=summarize,
|
16 |
+
inputs=gr.Textbox(label="Input Text", placeholder="Enter text to summarize..."),
|
17 |
+
outputs=gr.Textbox(label="Summary"),
|
18 |
+
title="Text Summarization",
|
19 |
+
description="Summarize the input text using BART model."
|
20 |
+
).launch()
|