Spaces:
Runtime error
Runtime error
import torch | |
import gradio as gr | |
from transformers import pipeline | |
text_summary = pipeline("summarization", model="sshleifer/distilbart-cnn-12-6", torch_dtype=torch.bfloat16) | |
# model_path = ("../Models/models--sshleifer--distilbart-cnn-12-6/snapshots" | |
# "/a4f8f3ea906ed274767e9906dbaede7531d660ff") | |
def summary(input_text): | |
output = text_summary(input_text) | |
return output[0]['summary_text'] | |
gr.close_all() | |
demo = gr.Interface(fn=summary, | |
inputs=[gr.Textbox(label="Input text to summarize", lines=6)], | |
outputs=[gr.Textbox(label="Summarized text", lines=4)], | |
title="@CreativeAI: Text Summarizer", | |
description="THIS APPLICATION WILL BE USED TO SUMMARIZE THE TEXT") | |
demo.launch() | |