Spaces:
Runtime error
Runtime error
File size: 709 Bytes
69c1e4c f449d52 69c1e4c f449d52 69c1e4c f449d52 f99e432 8bf28d6 f449d52 69c1e4c dd7a857 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
import gradio as gr
from transformers import pipeline
pipe = pipeline("summarization", model="Gabriel/bart-base-cnn-xsum-swe")
def main(in_text):
print(in_text)
answer = pipe(in_text, num_beams=5 ,min_length=5, max_length=20)
print(answer)
return answer[0]["summary_text"]
with gr.Blocks() as demo:
gr.Markdown("""# Summarization Engine!""")
with gr.Row():
with gr.Column():
text1 = gr.Textbox(
label="Input Text",
lines=1,
)
output = gr.Textbox(label="Output Text")
b1 = gr.Button("Summarize!")
b1.click(main, inputs=[text1], outputs=output)
gr.Markdown("""#### Created by Gabriel""")
if __name__ == "__main__":
demo.launch() |