Spaces:
Build error
Build error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
# Load the summarization pipeline
|
| 5 |
+
summarizer = pipeline("summarization")
|
| 6 |
+
|
| 7 |
+
def summarize_text(text):
|
| 8 |
+
summary = summarizer(text, max_length=130, min_length=30, do_sample=False)[0]['summary_text']
|
| 9 |
+
return summary
|
| 10 |
+
|
| 11 |
+
iface = gr.Interface(fn=summarize_text, inputs="textbox", outputs="textbox", title="Text Summarizer", description="Enter text to get a summarized version.")
|
| 12 |
+
iface.launch()
|