anaspro commited on
Commit
5c40a76
·
1 Parent(s): fbd6279

Add NB TEL system prompt integration and Arabic UI updates

Browse files

- Integrate system_prompt.txt file loading for default system prompt
- Update Gradio examples to match Iraqi internet service support context
- Replace English description with Arabic NB TEL assistant branding
- Add Arabic examples for internet support queries in Iraqi dialect

Files changed (1) hide show
  1. app.py +29 -7
app.py CHANGED
@@ -3,6 +3,7 @@ from threading import Thread
3
  import gradio as gr
4
  import spaces
5
  import re
 
6
  from openai_harmony import (
7
  load_harmony_encoding,
8
  HarmonyEncodingName,
@@ -14,6 +15,16 @@ from openai_harmony import (
14
  ReasoningEffort,
15
  )
16
 
 
 
 
 
 
 
 
 
 
 
17
  # regex config
18
  RE_REASONING = re.compile(r'(?i)Reasoning:\s*(low|medium|high)')
19
  RE_FINAL_MARKER = re.compile(r'(?i)assistantfinal')
@@ -110,7 +121,7 @@ demo = gr.ChatInterface(
110
  gr.Slider(label="Max new tokens", minimum=64, maximum=4096, step=1, value=2048),
111
  gr.Textbox(
112
  label="System Prompt",
113
- value="You are a helpful assistant. Reasoning: medium",
114
  lines=4,
115
  placeholder="Change system prompt"
116
  ),
@@ -120,15 +131,26 @@ demo = gr.ChatInterface(
120
  gr.Slider(label="Repetition Penalty", minimum=1.0, maximum=2.0, step=0.05, value=1.0)
121
  ],
122
  examples=[
123
- [{"text": "Explain Newton laws clearly and concisely"}],
124
- [{"text": "What are the benefits of open weight AI models"}],
125
- [{"text": "Write a Python function to calculate the Fibonacci sequence"}],
126
-
 
127
  ],
128
  cache_examples=False,
129
  type="messages",
130
- description="""# gpt-oss-20b Demo
131
- Give it a couple of seconds to start. You can adjust reasoning level in the system prompt like "Reasoning: high." Click to view thinking process (default is on).""",
 
 
 
 
 
 
 
 
 
 
132
  fill_height=True,
133
  textbox=gr.Textbox(
134
  label="Query Input",
 
3
  import gradio as gr
4
  import spaces
5
  import re
6
+ import os
7
  from openai_harmony import (
8
  load_harmony_encoding,
9
  HarmonyEncodingName,
 
15
  ReasoningEffort,
16
  )
17
 
18
+ # Load system prompt from file
19
+ def load_system_prompt():
20
+ try:
21
+ with open('system_prompt.txt', 'r', encoding='utf-8') as f:
22
+ return f.read().strip()
23
+ except FileNotFoundError:
24
+ return "You are a helpful assistant. Reasoning: medium"
25
+
26
+ DEFAULT_SYSTEM_PROMPT = load_system_prompt()
27
+
28
  # regex config
29
  RE_REASONING = re.compile(r'(?i)Reasoning:\s*(low|medium|high)')
30
  RE_FINAL_MARKER = re.compile(r'(?i)assistantfinal')
 
121
  gr.Slider(label="Max new tokens", minimum=64, maximum=4096, step=1, value=2048),
122
  gr.Textbox(
123
  label="System Prompt",
124
+ value=DEFAULT_SYSTEM_PROMPT,
125
  lines=4,
126
  placeholder="Change system prompt"
127
  ),
 
131
  gr.Slider(label="Repetition Penalty", minimum=1.0, maximum=2.0, step=0.05, value=1.0)
132
  ],
133
  examples=[
134
+ [{"text": "النت عندي ما يشتغل من الصبح، شنو السبب وكيف نحله؟"}],
135
+ [{"text": "كم سعر باقة 60 ميجا وشلون اشترك فيها؟"}],
136
+ [{"text": "الواي فاي ما يظهر على الموبايل، شنو المشكلة؟"}],
137
+ [{"text": "شنو الباقات المتوفرة ومميزات كل باقة؟"}],
138
+ [{"text": "كيف اغير اسم ورمز الواي فاي؟"}],
139
  ],
140
  cache_examples=False,
141
  type="messages",
142
+ description="""🤖 مساعد ذكي متقدم يعتمد على /Lahja-iraqi-4B من anaspro للدعم الفني بشبكة النور - NB TEL
143
+
144
+ ✨ قدرات متقدمة:
145
+
146
+ 🧠 تفكير منطقي عميق (Chain-of-Thought)
147
+ 📊 حلول خطوة بخطوة مع التحليل
148
+ 🎯 مستويات تفكير قابلة للتعديل (Reasoning: low/medium/high)
149
+ 💬 دعم كامل للغة العربية العراقية
150
+ 🔧 تشخيص وحلول متقدمة للمشاكل التقنية
151
+ احجي معاه كأنك زبون: اشرح مشكلتك، اسأل عن الباقات، او اطلب تذكرة دعم.
152
+
153
+ يمكنك رؤية عملية التفكير (Thinking Process) عند النقر على السهم أعلى الإجابة.""",
154
  fill_height=True,
155
  textbox=gr.Textbox(
156
  label="Query Input",