casamN commited on
Commit
e0c35e4
·
verified ·
1 Parent(s): c096ba0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +41 -3
app.py CHANGED
@@ -206,7 +206,15 @@ def build_app():
206
  with gr.Tabs():
207
  # Dictionary Tab
208
  with gr.TabItem("Dictionary Translator"):
209
- gr.Markdown("### Quick Word Translation — **Kiembu ↔ English**")
 
 
 
 
 
 
 
 
210
  inp = gr.Textbox(label="Enter Word", placeholder="e.g. 'Uvoro' or 'how are you'", lines=1)
211
  dir_sel = gr.Radio(["Kiembu → English", "English → Kiembu"], value="Kiembu → English", label="Select Direction")
212
  out = gr.Textbox(label="Translation Result")
@@ -214,7 +222,11 @@ def build_app():
214
 
215
  # PDF Translation Tab
216
  with gr.TabItem("PDF Translation"):
217
- gr.Markdown("### Upload English PDF → Get Kiembu Translated PDF")
 
 
 
 
218
  pdf_input = gr.File(label="Upload English PDF", file_types=[".pdf"])
219
  translate_btn = gr.Button("Translate to Kiembu")
220
  output_file = gr.File(label="Download Translated PDF")
@@ -223,7 +235,15 @@ def build_app():
223
 
224
  # NRF LLM Model Q&A Tab
225
  with gr.TabItem("PDF Chat (NRF LLM Model)"):
226
- gr.Markdown("### Ask Questions from Any PDF using the NRF LLM Model")
 
 
 
 
 
 
 
 
227
  pdf = gr.File(label="Upload PDF Document")
228
  status = gr.Textbox(label="Status")
229
  gr.Button("Process PDF").click(load_pdf_and_prepare, pdf, status)
@@ -232,6 +252,24 @@ def build_app():
232
  ans = gr.Textbox(lines=6, label="Answer")
233
  gr.Button("Query PDF").click(query_pdf, q, ans)
234
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
235
  gr.Markdown("""
236
  <hr style='border:0.5px solid #ccc'>
237
  <div style='text-align:center;color:#003366;font-size:14px'>
 
206
  with gr.Tabs():
207
  # Dictionary Tab
208
  with gr.TabItem("Dictionary Translator"):
209
+ gr.Markdown("### Quick Word Translation — **Kiembu ↔ English** and get its translation instantly.
210
+
211
+ 🔤 **Sample Words:**
212
+ | Kiembu | English |
213
+ |:--|:--|
214
+ | Uvoro | how are you |
215
+ | Ri? | When? |
216
+ | Ku? | Where? |
217
+ | Uka | come |")
218
  inp = gr.Textbox(label="Enter Word", placeholder="e.g. 'Uvoro' or 'how are you'", lines=1)
219
  dir_sel = gr.Radio(["Kiembu → English", "English → Kiembu"], value="Kiembu → English", label="Select Direction")
220
  out = gr.Textbox(label="Translation Result")
 
222
 
223
  # PDF Translation Tab
224
  with gr.TabItem("PDF Translation"):
225
+ gr.Markdown("""
226
+ ### **English → Kiembu PDF Translator**
227
+ Upload an **English PDF document** (e.g., ID or passport application, hospital form, etc.),
228
+ and the system will translate it into **Kiembu** and generate a downloadable translated PDF.
229
+ """)
230
  pdf_input = gr.File(label="Upload English PDF", file_types=[".pdf"])
231
  translate_btn = gr.Button("Translate to Kiembu")
232
  output_file = gr.File(label="Download Translated PDF")
 
235
 
236
  # NRF LLM Model Q&A Tab
237
  with gr.TabItem("PDF Chat (NRF LLM Model)"):
238
+ gr.Markdown("""
239
+ ### **Interactive PDF Chat (Gemma Q&A)**
240
+ Upload any **informative PDF** (e.g., government reports, history books, manuals)
241
+ and ask natural-language questions to understand its content better.
242
+
243
+ Example:
244
+ - *“What does this document say about birth registration?”*
245
+ - *“Summarize Chapter 2.”*
246
+ """)
247
  pdf = gr.File(label="Upload PDF Document")
248
  status = gr.Textbox(label="Status")
249
  gr.Button("Process PDF").click(load_pdf_and_prepare, pdf, status)
 
252
  ans = gr.Textbox(lines=6, label="Answer")
253
  gr.Button("Query PDF").click(query_pdf, q, ans)
254
 
255
+ # -----------------------------
256
+ # TAB 4: ABOUT
257
+ # -----------------------------
258
+ with gr.TabItem("About"):
259
+ gr.Markdown(
260
+ """
261
+ ### About the Project
262
+ The **NRF Kenya Project** on *Creating LLMs that Understand Native Languages*
263
+ aims to preserve and promote indigenous linguistic heritage through advanced AI translation tools.
264
+
265
+ - **Languages Supported:** Kiembu ↔ English
266
+ - **Core Engine:** NRF LLM Model (based on lightweight MarianMT)
267
+ - **Developed by:** Casam Njagi Nyaga
268
+ - **Funding Agency:** National Research Fund (NRF), Kenya
269
+ - **Objective:** Foster inclusion of native languages in AI-driven communication.
270
+ """
271
+ )
272
+
273
  gr.Markdown("""
274
  <hr style='border:0.5px solid #ccc'>
275
  <div style='text-align:center;color:#003366;font-size:14px'>