Spaces:
Runtime error
Runtime error
app.py
Browse files
app.py
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import pipeline
|
2 |
+
import gradio as gr
|
3 |
+
summarizer = pipeline("summarization")
|
4 |
+
def summarize(inp):
|
5 |
+
inp = inp.replace('\n','')
|
6 |
+
#inp = tokenizer.encode(inp, return_tensors='pt', max_length=1024)
|
7 |
+
#summary_ids = model.generate(inp, num_beams=4, max_length=150, early_stopping=True)
|
8 |
+
summary = summarizer(inp)
|
9 |
+
return summary
|
10 |
+
gr.Interface(fn=summarize,
|
11 |
+
inputs=gr.inputs.Textbox(lines=7, label="Input Text"),
|
12 |
+
outputs="text").launch(inline=False)
|