Spaces:
Running
Running
import torch | |
import gradio as gr | |
from transformers import pipeline | |
#text_summary = pipeline("summarization", model="sshleifer/distilbart-cnn-12-6", torch_dtype=torch.bfloat16) | |
de_text_summary = pipeline("summarization", model="Shahm/bart-german") | |
#de_text_summary= pipeline("summarization", model="Joemgu/mlong-t5-large-sumstew") | |
def summary (input): | |
max_length = 1024 # adjust this value as needed | |
if len(input) > max_length: | |
input = input[:max_length] | |
output = de_text_summary(input) | |
return output[0]['summary_text'] | |
gr.close_all() | |
# demo = gr.Interface(fn=summary, inputs="text",outputs="text") | |
demo = gr.Interface(fn=summary, | |
inputs=[gr.Textbox(label="Text eingeben, der zusammengefasst werden soll",lines=6)], | |
outputs=[gr.Textbox(label="Zusammengefasster Text",lines=4)], | |
title="Projekt 1: Text-Zusammenfassung", | |
description="DIESE ANWENDUNG WIRD ZUR ZUSAMMENFASSUNG DES TEXTES VERWENDET", | |
theme="default", | |
allow_flagging="never", | |
clear_btn="Bereinigen", | |
submit_btn="Übermitteln" | |
) | |
demo.launch() |