Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -49,6 +49,25 @@ gemma_3_formatter = MessagesFormatter(
|
|
| 49 |
eos_token="<eos>", # End of sequence token for Gemma 3
|
| 50 |
)
|
| 51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
|
| 53 |
# Set the title and description
|
| 54 |
title = "Kazakh Language Model"
|
|
@@ -61,7 +80,7 @@ llm_model = None
|
|
| 61 |
def respond(
|
| 62 |
message: str,
|
| 63 |
history: List[Tuple[str, str]],
|
| 64 |
-
|
| 65 |
system_message: str = "",
|
| 66 |
max_tokens: int = 64,
|
| 67 |
temperature: float = 0.7,
|
|
@@ -172,12 +191,9 @@ demo = gr.ChatInterface(
|
|
| 172 |
),
|
| 173 |
additional_inputs=[
|
| 174 |
gr.Dropdown(
|
| 175 |
-
choices=[
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
value="gemma_3_800M_sft_v2_translation-kazparc_latest.gguf",
|
| 179 |
-
label="Model",
|
| 180 |
-
info="Select the AI model to use for chat",
|
| 181 |
),
|
| 182 |
gr.Textbox(
|
| 183 |
value="You are a helpful assistant.",
|
|
|
|
| 49 |
eos_token="<eos>", # End of sequence token for Gemma 3
|
| 50 |
)
|
| 51 |
|
| 52 |
+
# Translation direction to prompts mapping
|
| 53 |
+
direction_to_prompts = {
|
| 54 |
+
"English to Kazakh": {
|
| 55 |
+
"system": "You are a professional translator. Translate the following sentence into қазақ.",
|
| 56 |
+
"prefix": "<src=en><tgt=kk>"
|
| 57 |
+
},
|
| 58 |
+
"Kazakh to English": {
|
| 59 |
+
"system": "Сіз кәсіби аудармашысыз. Төмендегі сөйлемді English тіліне аударыңыз.",
|
| 60 |
+
"prefix": "<src=kk><tgt=en>"
|
| 61 |
+
},
|
| 62 |
+
"Kazakh to Russian": {
|
| 63 |
+
"system": "Сіз кәсіби аудармашысыз. Төмендегі сөйлемді орыс тіліне аударыңыз.",
|
| 64 |
+
"prefix": "<src=kk><tgt=ru>"
|
| 65 |
+
},
|
| 66 |
+
"Russian to Kazakh": {
|
| 67 |
+
"system": "Вы профессиональный переводчик. Переведите следующее предложение на қазақ язык.",
|
| 68 |
+
"prefix": "<src=ru><tgt=kk>"
|
| 69 |
+
}
|
| 70 |
+
}
|
| 71 |
|
| 72 |
# Set the title and description
|
| 73 |
title = "Kazakh Language Model"
|
|
|
|
| 80 |
def respond(
|
| 81 |
message: str,
|
| 82 |
history: List[Tuple[str, str]],
|
| 83 |
+
direction: str,
|
| 84 |
system_message: str = "",
|
| 85 |
max_tokens: int = 64,
|
| 86 |
temperature: float = 0.7,
|
|
|
|
| 191 |
),
|
| 192 |
additional_inputs=[
|
| 193 |
gr.Dropdown(
|
| 194 |
+
choices=["English to Kazakh", "Kazakh to English", "Kazakh to Russian", "Russian to Kazakh"],
|
| 195 |
+
label="Translation Direction",
|
| 196 |
+
info="Select the direction of translation"
|
|
|
|
|
|
|
|
|
|
| 197 |
),
|
| 198 |
gr.Textbox(
|
| 199 |
value="You are a helpful assistant.",
|