Spaces:
Runtime error
Runtime error
Commit
·
0fee200
1
Parent(s):
aa24f38
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use a pipeline as a high-level helper
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
pipe = pipeline("summarization", model="ayoubkirouane/T5-4-Summarization")
|
| 4 |
+
def summarization(text) :
|
| 5 |
+
return pipe(text)[0]["summary_text"]
|
| 6 |
+
# Create a Gradio interface
|
| 7 |
+
iface = gr.Interface(
|
| 8 |
+
fn=summarization,
|
| 9 |
+
inputs=gr.Textbox(prompt="Input Text"),
|
| 10 |
+
outputs=gr.Textbox(prompt="Generated Summary") ,
|
| 11 |
+
allow_flagging=False
|
| 12 |
+
)
|
| 13 |
+
|
| 14 |
+
# Launch the Gradio app
|
| 15 |
+
iface.launch(debug=True)
|