import torch import gradio as gr from transformers import pipeline # Use the Dicta IL model for summarization with a manual prompt in Hebrew model_name = "dicta-il/dictalm2.0" text_summary = pipeline("text2text-generation", model=model_name, torch_dtype=torch.bfloat16) def summary(input): # Create a prompt in Hebrew for summarization prompt = f"סכם את הטקסט הבא: {input}" # Increase max_length and set max_new_tokens to avoid input length issues output = text_summary(prompt, max_new_tokens=512, min_length=30, do_sample=False) return output[0]['generated_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()