Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,5 @@
|
|
| 1 |
# -*- coding: utf-8 -*-
|
| 2 |
# app.py – Arabic Questions Summarization in Mental Healthcare with ALLaM
|
| 3 |
-
# Based 1-to-1 on the original Colab notebook (no changes to instructions).
|
| 4 |
|
| 5 |
import torch
|
| 6 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
|
@@ -27,7 +26,7 @@ model = AutoModelForCausalLM.from_pretrained(
|
|
| 27 |
)
|
| 28 |
|
| 29 |
# ------------------------------------------------------------------
|
| 30 |
-
# 3. Generation helpers
|
| 31 |
# ------------------------------------------------------------------
|
| 32 |
def generate_chat_response(
|
| 33 |
system_text: str,
|
|
@@ -70,7 +69,7 @@ def generate_text(prompt: str, max_new_tokens: int = 60):
|
|
| 70 |
)
|
| 71 |
|
| 72 |
# ------------------------------------------------------------------
|
| 73 |
-
# 4. Prompt construction
|
| 74 |
# ------------------------------------------------------------------
|
| 75 |
def prompt_short_question_cot_few_shots(question_text: str) -> str:
|
| 76 |
examples = """
|
|
|
|
| 1 |
# -*- coding: utf-8 -*-
|
| 2 |
# app.py – Arabic Questions Summarization in Mental Healthcare with ALLaM
|
|
|
|
| 3 |
|
| 4 |
import torch
|
| 5 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
|
|
|
| 26 |
)
|
| 27 |
|
| 28 |
# ------------------------------------------------------------------
|
| 29 |
+
# 3. Generation helpers
|
| 30 |
# ------------------------------------------------------------------
|
| 31 |
def generate_chat_response(
|
| 32 |
system_text: str,
|
|
|
|
| 69 |
)
|
| 70 |
|
| 71 |
# ------------------------------------------------------------------
|
| 72 |
+
# 4. Prompt construction
|
| 73 |
# ------------------------------------------------------------------
|
| 74 |
def prompt_short_question_cot_few_shots(question_text: str) -> str:
|
| 75 |
examples = """
|