Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#python3
|
| 2 |
+
#build a text summarizer using hugging face and gradio
|
| 3 |
+
|
| 4 |
+
import gradio as gr
|
| 5 |
+
import pandas as pd
|
| 6 |
+
import numpy as np
|
| 7 |
+
from transformers import pipeline
|
| 8 |
+
|
| 9 |
+
def summarize(text):
|
| 10 |
+
summarizer = pipeline("summarization")
|
| 11 |
+
return summarizer(text, max_length=512)[0]['summary_text']
|
| 12 |
+
|
| 13 |
+
iface = gr.Interface(summarize, "textbox", "label")
|
| 14 |
+
if __name__ == "__main__":
|
| 15 |
+
iface.launch()
|