Hwilner commited on
Commit
10c5e8e
·
verified ·
1 Parent(s): 64eca7c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -2,13 +2,16 @@ import torch
2
  import gradio as gr
3
  from transformers import pipeline
4
 
5
- # Use the mT5 model for multilingual summarization, including Hebrew
6
- text_summary = pipeline("summarization", model="csebuetnlp/mT5_multilingual_XLSum", torch_dtype=torch.bfloat16)
 
7
 
8
  def summary(input):
 
 
9
  # Increase max_length and set max_new_tokens to avoid input length issues
10
- output = text_summary(input, max_length=512, min_length=30, do_sample=False)
11
- return output[0]['summary_text']
12
 
13
  gr.close_all()
14
 
 
2
  import gradio as gr
3
  from transformers import pipeline
4
 
5
+ # Use the Dicta IL model for summarization with a manual prompt in Hebrew
6
+ model_name = "dicta-il/dictalm2.0"
7
+ text_summary = pipeline("text2text-generation", model=model_name, torch_dtype=torch.bfloat16)
8
 
9
  def summary(input):
10
+ # Create a prompt in Hebrew for summarization
11
+ prompt = f"סכם את הטקסט הבא: {input}"
12
  # Increase max_length and set max_new_tokens to avoid input length issues
13
+ output = text_summary(prompt, max_length=512, min_length=30, do_sample=False)
14
+ return output[0]['generated_text']
15
 
16
  gr.close_all()
17