from transformers import BertTokenizer import os import io from IPython.display import Image, display, HTML from PIL import Image import base64 import torch from transformers import pipeline from transformers import AutoModel acc_token='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' get_completion = pipeline("summarization", model="sshleifer/distilbart-cnn-12-6") def summarize(input): output = get_completion(input) return output[0]['summary_text'] import gradio as gr def summarize(input): output = get_completion(input) return output[0]['summary_text'] gr.close_all() demo = gr.Interface(fn=summarize, inputs="text", outputs="text") demo.launch(share=True)