Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -2,13 +2,16 @@ import torch
|
|
2 |
import gradio as gr
|
3 |
from transformers import pipeline
|
4 |
|
5 |
-
# Use the
|
6 |
-
|
|
|
7 |
|
8 |
def summary(input):
|
|
|
|
|
9 |
# Increase max_length and set max_new_tokens to avoid input length issues
|
10 |
-
output = text_summary(
|
11 |
-
return output[0]['
|
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 |
|