Denis202 commited on
Commit
dda5723
ยท
1 Parent(s): 2e9e9e6
Files changed (2) hide show
  1. =2.5.1 +29 -0
  2. app.py +86 -109
=2.5.1 ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Collecting torch
2
+ Using cached torch-2.8.0-cp312-cp312-manylinux_2_28_x86_64.whl.metadata (30 kB)
3
+ Requirement already satisfied: filelock in ./swahili-llm-training/swahili-env/lib/python3.12/site-packages (from torch) (3.19.1)
4
+ Requirement already satisfied: typing-extensions>=4.10.0 in ./swahili-llm-training/swahili-env/lib/python3.12/site-packages (from torch) (4.14.1)
5
+ Requirement already satisfied: setuptools in ./swahili-llm-training/swahili-env/lib/python3.12/site-packages (from torch) (80.9.0)
6
+ Requirement already satisfied: sympy>=1.13.3 in ./swahili-llm-training/swahili-env/lib/python3.12/site-packages (from torch) (1.14.0)
7
+ Requirement already satisfied: networkx in ./swahili-llm-training/swahili-env/lib/python3.12/site-packages (from torch) (3.5)
8
+ Requirement already satisfied: jinja2 in ./swahili-llm-training/swahili-env/lib/python3.12/site-packages (from torch) (3.1.6)
9
+ Requirement already satisfied: fsspec in ./swahili-llm-training/swahili-env/lib/python3.12/site-packages (from torch) (2025.3.0)
10
+ Requirement already satisfied: nvidia-cuda-nvrtc-cu12==12.8.93 in ./swahili-llm-training/swahili-env/lib/python3.12/site-packages (from torch) (12.8.93)
11
+ Requirement already satisfied: nvidia-cuda-runtime-cu12==12.8.90 in ./swahili-llm-training/swahili-env/lib/python3.12/site-packages (from torch) (12.8.90)
12
+ Requirement already satisfied: nvidia-cuda-cupti-cu12==12.8.90 in ./swahili-llm-training/swahili-env/lib/python3.12/site-packages (from torch) (12.8.90)
13
+ Requirement already satisfied: nvidia-cudnn-cu12==9.10.2.21 in ./swahili-llm-training/swahili-env/lib/python3.12/site-packages (from torch) (9.10.2.21)
14
+ Requirement already satisfied: nvidia-cublas-cu12==12.8.4.1 in ./swahili-llm-training/swahili-env/lib/python3.12/site-packages (from torch) (12.8.4.1)
15
+ Requirement already satisfied: nvidia-cufft-cu12==11.3.3.83 in ./swahili-llm-training/swahili-env/lib/python3.12/site-packages (from torch) (11.3.3.83)
16
+ Requirement already satisfied: nvidia-curand-cu12==10.3.9.90 in ./swahili-llm-training/swahili-env/lib/python3.12/site-packages (from torch) (10.3.9.90)
17
+ Requirement already satisfied: nvidia-cusolver-cu12==11.7.3.90 in ./swahili-llm-training/swahili-env/lib/python3.12/site-packages (from torch) (11.7.3.90)
18
+ Requirement already satisfied: nvidia-cusparse-cu12==12.5.8.93 in ./swahili-llm-training/swahili-env/lib/python3.12/site-packages (from torch) (12.5.8.93)
19
+ Requirement already satisfied: nvidia-cusparselt-cu12==0.7.1 in ./swahili-llm-training/swahili-env/lib/python3.12/site-packages (from torch) (0.7.1)
20
+ Requirement already satisfied: nvidia-nccl-cu12==2.27.3 in ./swahili-llm-training/swahili-env/lib/python3.12/site-packages (from torch) (2.27.3)
21
+ Requirement already satisfied: nvidia-nvtx-cu12==12.8.90 in ./swahili-llm-training/swahili-env/lib/python3.12/site-packages (from torch) (12.8.90)
22
+ Requirement already satisfied: nvidia-nvjitlink-cu12==12.8.93 in ./swahili-llm-training/swahili-env/lib/python3.12/site-packages (from torch) (12.8.93)
23
+ Requirement already satisfied: nvidia-cufile-cu12==1.13.1.3 in ./swahili-llm-training/swahili-env/lib/python3.12/site-packages (from torch) (1.13.1.3)
24
+ Requirement already satisfied: triton==3.4.0 in ./swahili-llm-training/swahili-env/lib/python3.12/site-packages (from torch) (3.4.0)
25
+ Requirement already satisfied: mpmath<1.4,>=1.1.0 in ./swahili-llm-training/swahili-env/lib/python3.12/site-packages (from sympy>=1.13.3->torch) (1.3.0)
26
+ Requirement already satisfied: MarkupSafe>=2.0 in ./swahili-llm-training/swahili-env/lib/python3.12/site-packages (from jinja2->torch) (3.0.2)
27
+ Using cached torch-2.8.0-cp312-cp312-manylinux_2_28_x86_64.whl (887.9 MB)
28
+ Installing collected packages: torch
29
+ Successfully installed torch-2.8.0
app.py CHANGED
@@ -66,148 +66,125 @@ def chat_interface(message, history):
66
  response = chatbot.generate_response(message)
67
  return response
68
 
69
- # Create Gradio interface with Tanzania flag colors and new layout
70
  with gr.Blocks(
71
  title="KiswahiliChetu",
72
- theme=gr.themes.Soft(primary_hue="blue"),
73
  css="""
74
- .gradio-container {
75
- max-width: 1200px;
76
- margin: auto;
77
  font-family: 'Arial', sans-serif;
78
- background: #f0f2f5;
79
  }
80
 
81
- /* Tanzania Flag Title inside White Shell */
82
- .tanzania-title-shell {
83
- display: inline-block;
84
- padding: 12px 25px;
85
- background: white;
86
- border-radius: 25px;
87
- box-shadow: 0px 4px 10px rgba(0,0,0,0.15);
88
- margin-bottom: 15px !important;
89
  }
90
 
91
- .tanzania-title {
92
- font-size: 3em !important;
93
  font-weight: bold !important;
94
- text-align: center;
95
- background: linear-gradient(to bottom,
96
- #1DB954 0% 35%, /* Green */
97
- #FFD700 35% 40%, /* Thin Yellow */
98
- #000000 40% 60%, /* Black */
99
- #FFD700 60% 65%, /* Thin Yellow */
100
- #87CEEB 65% 100% /* Sky Blue */
101
- );
102
- -webkit-background-clip: text;
103
- -webkit-text-fill-color: transparent;
104
- background-clip: text;
105
- display: inline-block;
106
  }
107
 
108
- .tanzania-subtitle {
109
- text-align: center;
110
- color: #666;
111
- margin-bottom: 30px !important;
112
  font-size: 1.2em;
 
 
113
  }
114
 
115
  .chat-container {
116
- background: #f8f9fa;
117
- padding: 20px;
118
- border-radius: 15px;
119
- border: 2px solid #e9ecef;
120
  }
121
 
122
- .input-container {
123
- background: #ffffff;
124
  padding: 20px;
125
- border-radius: 15px;
126
- border: 2px solid #e9ecef;
127
- }
128
-
129
- .gradio-button {
130
- border-radius: 8px;
131
- font-weight: bold;
132
  }
133
 
134
- .examples-section {
135
  background: #fffae6;
136
  padding: 15px;
137
  border-radius: 10px;
 
138
  border-left: 4px solid #FCD116;
139
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
140
  """
141
  ) as demo:
142
 
143
- # Header with Tanzania flag colors inside white shell
144
  gr.HTML("""
145
- <div style="text-align: center;">
146
- <div class="tanzania-title-shell">
147
- <span class="tanzania-title">KiswahiliChetu</span>
148
- </div>
149
- <p class="tanzania-subtitle">Jifunze kiswahili fasaha, uliza maswali na KiswahiliChetu akili mnemba</p>
150
  </div>
151
  """)
152
 
153
- with gr.Row():
154
- # LEFT SIDE: Input section
155
- with gr.Column(scale=1, min_width=400):
156
- with gr.Column(elem_classes="input-container"):
157
- gr.Markdown("### โœ๏ธ Ujumbe Wako")
158
-
159
- msg = gr.Textbox(
160
- label="",
161
- placeholder="Andika hapa kwa Kiswahili...",
162
- lines=4,
163
- max_lines=6,
164
- show_label=False
165
- )
166
-
167
- with gr.Row():
168
- submit_btn = gr.Button("๐Ÿ“ค Tuma", variant="primary", size="lg")
169
- clear_btn = gr.Button("๐Ÿ—‘๏ธ Futa Mazungumzo", variant="secondary")
170
-
171
- # Examples section
172
- with gr.Accordion("๐Ÿ“š Mifano ya Maswali", open=True):
173
- gr.Examples(
174
- examples=[
175
- ["Habari yako?"],
176
- ["Jina lako nani?"],
177
- ["Unaweza kusema Kiswahili?"],
178
- ["Eleza kuhusu Tanzania"],
179
- ["Nini maana ya 'Hakuna matata'?"]
180
- ],
181
- inputs=msg,
182
- label="Bonyeza mfano wa swali:"
183
- )
184
 
185
- # RIGHT SIDE: Chat section
186
- with gr.Column(scale=2, min_width=600):
187
- with gr.Column(elem_classes="chat-container"):
188
- gr.Markdown("### ๐Ÿ’ฌ Mazungumzo")
189
- chatbot_ui = gr.Chatbot(
190
- height=500,
191
- show_copy_button=True,
192
- show_share_button=True,
193
- avatar_images=(
194
- None,
195
- "https://api.dicebear.com/7.x/bottts/svg?seed=swahili&backgroundColor=1eb53a"
196
- )
197
- )
198
-
199
- # System info and footer
200
- with gr.Accordion("๐Ÿ“Š Taarifa ya Mfumo", open=False):
201
- gr.Markdown(f"""
202
- **Gradio Version:** 5.43.1
203
- **Transformers:** 4.30.2
204
- **PyTorch:** 2.0.1
205
- **Device:** CPU
206
- """)
207
-
208
- gr.Markdown("---")
209
- gr.Markdown("""
210
- <div style='text-align: center; color: #666;'>
 
 
 
 
 
211
  <strong>๐Ÿ‡น๐Ÿ‡ฟ Imetengenezwa kwa upendo wa lugha ya Kiswahili na Tanzania</strong>
212
  </div>
213
  """)
 
66
  response = chatbot.generate_response(message)
67
  return response
68
 
69
+ # Create simplified modern chat interface
70
  with gr.Blocks(
71
  title="KiswahiliChetu",
72
+ theme=gr.themes.Soft(primary_hue="green"),
73
  css="""
74
+ .gradio-container {
75
+ max-width: 800px;
76
+ margin: auto;
77
  font-family: 'Arial', sans-serif;
 
78
  }
79
 
80
+ .header {
81
+ text-align: center;
82
+ padding: 20px;
83
+ background: linear-gradient(135deg, #1DB954 0%, #87CEEB 100%);
84
+ color: white;
85
+ border-radius: 10px;
86
+ margin-bottom: 20px;
 
87
  }
88
 
89
+ .chat-title {
90
+ font-size: 2.5em !important;
91
  font-weight: bold !important;
92
+ margin: 0;
 
 
 
 
 
 
 
 
 
 
 
93
  }
94
 
95
+ .chat-subtitle {
 
 
 
96
  font-size: 1.2em;
97
+ opacity: 0.9;
98
+ margin: 5px 0 0 0;
99
  }
100
 
101
  .chat-container {
102
+ border: 1px solid #e0e0e0;
103
+ border-radius: 10px;
104
+ overflow: hidden;
105
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
106
  }
107
 
108
+ .input-area {
 
109
  padding: 20px;
110
+ background: #f8f9fa;
111
+ border-top: 1px solid #e0e0e0;
 
 
 
 
 
112
  }
113
 
114
+ .examples {
115
  background: #fffae6;
116
  padding: 15px;
117
  border-radius: 10px;
118
+ margin-top: 15px;
119
  border-left: 4px solid #FCD116;
120
  }
121
+
122
+ .examples-title {
123
+ font-weight: bold;
124
+ margin-bottom: 10px;
125
+ color: #333;
126
+ }
127
+
128
+ .footer {
129
+ text-align: center;
130
+ margin-top: 20px;
131
+ color: #666;
132
+ font-size: 0.9em;
133
+ }
134
  """
135
  ) as demo:
136
 
137
+ # Header
138
  gr.HTML("""
139
+ <div class="header">
140
+ <h1 class="chat-title">KiswahiliChetu</h1>
141
+ <p class="chat-subtitle">Jifunze kiswahili fasaha, uliza maswali na KiswahiliChetu</p>
 
 
142
  </div>
143
  """)
144
 
145
+ # Main chat interface
146
+ with gr.Column(elem_classes="chat-container"):
147
+ chatbot_ui = gr.Chatbot(
148
+ height=400,
149
+ show_copy_button=True,
150
+ show_share_button=True,
151
+ avatar_images=(
152
+ None,
153
+ "https://api.dicebear.com/7.x/bottts/svg?seed=swahili&backgroundColor=1eb53a"
154
+ )
155
+ )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
156
 
157
+ with gr.Column(elem_classes="input-area"):
158
+ msg = gr.Textbox(
159
+ label="",
160
+ placeholder="Andika hapa kwa Kiswahili...",
161
+ lines=2,
162
+ max_lines=4,
163
+ show_label=False
164
+ )
165
+
166
+ with gr.Row():
167
+ submit_btn = gr.Button("๐Ÿ“ค Tuma", variant="primary")
168
+ clear_btn = gr.Button("๐Ÿ—‘๏ธ Futa", variant="secondary")
169
+
170
+ # Examples section
171
+ with gr.Column(elem_classes="examples"):
172
+ gr.Markdown("**๐Ÿ“š Mifano ya Maswali**")
173
+ gr.Examples(
174
+ examples=[
175
+ ["Habari yako?"],
176
+ ["Jina lako nani?"],
177
+ ["Unaweza kusema Kiswahili?"],
178
+ ["Eleza kuhusu Tanzania"],
179
+ ["Nini maana ya 'Hakuna matata'?"]
180
+ ],
181
+ inputs=msg,
182
+ label=""
183
+ )
184
+
185
+ # Footer
186
+ gr.HTML("""
187
+ <div class="footer">
188
  <strong>๐Ÿ‡น๐Ÿ‡ฟ Imetengenezwa kwa upendo wa lugha ya Kiswahili na Tanzania</strong>
189
  </div>
190
  """)