Spaces:
Sleeping
Sleeping
Alimubariz124
commited on
Commit
•
6d5f333
1
Parent(s):
6cb6909
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
get_completion = pipeline("summarization", model="sshleifer/distilbart-cnn-12-6")
|
5 |
+
|
6 |
+
def summarize(input):
|
7 |
+
output = get_completion(input)
|
8 |
+
return output[0]['summary_text']
|
9 |
+
|
10 |
+
iface = gr.Interface(
|
11 |
+
fn=summarize,
|
12 |
+
inputs="text",
|
13 |
+
outputs="text",
|
14 |
+
title="Text Summarization",
|
15 |
+
description="Summarize input text using a pre-trained model."
|
16 |
+
)
|
17 |
+
|
18 |
+
iface.launch()
|