Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
## suppress warnings
|
2 |
+
from transformers.utils import logging
|
3 |
+
logging.set_verbosity_error()
|
4 |
+
|
5 |
+
import warnings
|
6 |
+
warnings.filterwarnings("ignore")
|
7 |
+
|
8 |
+
from transformers import pipeline
|
9 |
+
pipe = pipeline(task = "summarization", model = "Falconsai/text_summarization")
|
10 |
+
def summarize(input_text) :
|
11 |
+
op = pipe(input_text)
|
12 |
+
return op[0]['summary_text']
|
13 |
+
|
14 |
+
import gradio as gr
|
15 |
+
iface = gr.Interface(fn = summarize, inputs = "text", outputs = "text")
|
16 |
+
iface.launch(share = True)
|