Spaces:
Runtime error
Runtime error
File size: 763 Bytes
0fadadf 64eca7c ac9bb28 bc233ce 64eca7c 0fadadf 64eca7c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
import torch
import gradio as gr
from transformers import pipeline
# Use the mT5 model for multilingual summarization, including Hebrew
text_summary = pipeline("summarization", model="csebuetnlp/mT5_multilingual_XLSum", torch_dtype=torch.bfloat16)
def summary(input):
# Increase max_length and set max_new_tokens to avoid input length issues
output = text_summary(input, max_length=512, min_length=30, do_sample=False)
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="Hebrew Text Summarizer",
description="This application will summarize Hebrew text."
)
demo.launch()
|