Spaces:
Sleeping
Sleeping
Commit
·
45659e5
1
Parent(s):
4ba2f9b
myfirstpipelinemodel
Browse files- app.py +21 -0
- requirements.txt +2 -0
app.py
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
# Initialize the summarization pipeline
|
5 |
+
pipe = pipeline("summarization")
|
6 |
+
|
7 |
+
# Define a function for the summarization
|
8 |
+
def summarize(text):
|
9 |
+
return pipe(text)[0]['summary_text']
|
10 |
+
|
11 |
+
# Create a Gradio interface
|
12 |
+
interface = gr.Interface(
|
13 |
+
fn=summarize,
|
14 |
+
inputs="text",
|
15 |
+
outputs="text",
|
16 |
+
title="Text Summarization",
|
17 |
+
description="Enter text to get a summary."
|
18 |
+
)
|
19 |
+
|
20 |
+
# Launch the interface
|
21 |
+
interface.launch()
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
transformers
|
2 |
+
gradio
|