Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,20 +1,20 @@
|
|
1 |
-
# Use a pipeline as a high-level helper
|
2 |
from transformers import pipeline
|
3 |
import gradio as gr
|
|
|
4 |
pipe = pipeline("summarization", model="ayoubkirouane/T5-4-Summarization")
|
5 |
-
|
6 |
-
|
|
|
|
|
7 |
# Create a Gradio interface
|
8 |
iface = gr.Interface(
|
9 |
fn=summarization,
|
10 |
-
inputs=gr.Textbox(
|
11 |
-
outputs=gr.Textbox(
|
12 |
-
allow_flagging=False
|
13 |
-
title="T5-4-Summarization"
|
14 |
description="This app generates a summary of the input text using T5 fine-tuned model.",
|
15 |
-
|
16 |
-
|
17 |
)
|
18 |
|
19 |
# Launch the Gradio app
|
20 |
-
iface.launch(debug=True)
|
|
|
|
|
1 |
from transformers import pipeline
|
2 |
import gradio as gr
|
3 |
+
|
4 |
pipe = pipeline("summarization", model="ayoubkirouane/T5-4-Summarization")
|
5 |
+
|
6 |
+
def summarization(text):
|
7 |
+
return pipe(text)[0]["summary_text"]
|
8 |
+
|
9 |
# Create a Gradio interface
|
10 |
iface = gr.Interface(
|
11 |
fn=summarization,
|
12 |
+
inputs=gr.Textbox(label="Input Text"),
|
13 |
+
outputs=gr.Textbox(label="Generated Summary"),
|
14 |
+
allow_flagging=False,
|
15 |
+
title="T5-4-Summarization",
|
16 |
description="This app generates a summary of the input text using T5 fine-tuned model.",
|
|
|
|
|
17 |
)
|
18 |
|
19 |
# Launch the Gradio app
|
20 |
+
iface.launch(debug=True)
|