Spaces:
Runtime error
Runtime error
File size: 634 Bytes
6ec48ce e8e2eea 6ec48ce |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
from transformers import pipeline
import gradio as gr
#model
model = pipeline("summarization", model="sshleifer/distilbart-cnn-12-6") #model="sshleifer/distilbart-cnn-12-6")
def func(Text):
words = Text.split()
grouped_words = [' '.join(words[i: i + 300]) for i in range(0, len(words), 300)]
summary_list = []
for i in grouped_words:
y = model(i, max_length=80, do_sample=False)
summary_list.append(y)
final_summary = ','.join(str(v) for v in summary_list)
return final_summary
import gradio as gr
app = gr.Interface(fn=func, inputs="textbox", outputs="textbox", title="InfluencerAI-Summarizer")
app.launch() |