abdullah693 commited on
Commit
0f4609e
·
verified ·
1 Parent(s): a1414fd

Chat front-and-centre; results below; fix invisible bold text; swap flower example

Browse files
Files changed (1) hide show
  1. app.py +18 -7
app.py CHANGED
@@ -53,6 +53,15 @@ CSS = """
53
  .note{background:#fbf6e9;border:1px solid #ecdfb8;border-radius:12px;padding:12px 16px;font-family:'Inter';font-size:.92rem;color:#4a4a4a}
54
  #foot{font-family:'Inter';font-size:.8rem;color:#888;text-align:center;margin-top:16px;line-height:1.7}
55
  #foot a{color:#0a7a43;text-decoration:none;font-weight:500}
 
 
 
 
 
 
 
 
 
56
  """
57
 
58
  HERO = """<div id="hero"><div class="in">
@@ -87,15 +96,22 @@ FOOT = """<div id="foot">Model: <a href="https://huggingface.co/abdullah693/gemm
87
  <i>Research/educational use — not authoritative for exams or religious rulings.</i></div>"""
88
 
89
  EXAMPLES = [
90
- "پاکستان کا قومی پھول کون سا ہے اور اس کی کیا خصوصیات ہیں؟",
91
  "اگر ایک ٹرین 60 کلومیٹر فی گھنٹہ کی رفتار سے 2.5 گھنٹے چلے تو کتنا فاصلہ طے کرے گی؟",
 
92
  "تعلیم کسی معاشرے کی ترقی میں کیا کردار ادا کرتی ہے؟ مختصر وضاحت کریں۔",
93
  "نظامِ شمسی میں کتنے سیارے ہیں اور سب سے بڑا سیارہ کون سا ہے؟",
94
  ]
95
 
96
  with gr.Blocks(title="Urdu Education & Reasoning", theme=gr.themes.Soft(primary_hue="emerald"), css=CSS) as demo:
97
  gr.HTML(HERO)
98
- gr.HTML('<div class="sec"><h2>The result</h2></div>')
 
 
 
 
 
 
 
99
  gr.HTML(KPI)
100
  with gr.Row():
101
  gr.Image("assets/fig_overall.png", show_label=False, container=False)
@@ -103,11 +119,6 @@ with gr.Blocks(title="Urdu Education & Reasoning", theme=gr.themes.Soft(primary_
103
  gr.HTML(APPROACH)
104
  gr.Image("assets/fig_data.png", show_label=False, container=False)
105
  gr.HTML(FINDING)
106
- gr.HTML('<div class="sec"><h2>Try it — اردو میں سوال پوچھیں</h2></div>')
107
- with gr.Accordion("⚙️ settings", open=False):
108
- mt = gr.Slider(64, 512, value=256, step=32, label="Max new tokens")
109
- tp = gr.Slider(0.0, 1.0, value=0.0, step=0.1, label="Temperature")
110
- gr.ChatInterface(respond, additional_inputs=[mt, tp], examples=[[e] for e in EXAMPLES], cache_examples=False)
111
  gr.HTML(FOOT)
112
 
113
  if __name__ == "__main__":
 
53
  .note{background:#fbf6e9;border:1px solid #ecdfb8;border-radius:12px;padding:12px 16px;font-family:'Inter';font-size:.92rem;color:#4a4a4a}
54
  #foot{font-family:'Inter';font-size:.8rem;color:#888;text-align:center;margin-top:16px;line-height:1.7}
55
  #foot a{color:#0a7a43;text-decoration:none;font-weight:500}
56
+ /* force visible (dark) text in light boxes regardless of light/dark theme */
57
+ .note,.note *{color:#3a3a3a!important}
58
+ .note b,.note strong{color:#01411C!important;font-weight:700}
59
+ .sec h2{color:#01411C!important}
60
+ .sec p,.sec p *{color:#26332b!important}
61
+ .sec p b,.sec p strong{color:#01411C!important}
62
+ .kpi .v{color:#0a7a43!important}.kpi .l{color:#555!important}
63
+ #foot,#foot *{color:#7a7a7a!important}#foot a{color:#0a7a43!important}
64
+ #hero p,#hero p *,#hero h1{color:#fff!important}#hero h1 .a{color:#e9c75a!important}
65
  """
66
 
67
  HERO = """<div id="hero"><div class="in">
 
96
  <i>Research/educational use — not authoritative for exams or religious rulings.</i></div>"""
97
 
98
  EXAMPLES = [
 
99
  "اگر ایک ٹرین 60 کلومیٹر فی گھنٹہ کی رفتار سے 2.5 گھنٹے چلے تو کتنا فاصلہ طے کرے گی؟",
100
+ "ایک دکاندار نے 500 روپے کی چیز پر 20 فیصد رعایت دی۔ گاہک کو اب کتنے روپے ادا کرنے ہوں گے؟",
101
  "تعلیم کسی معاشرے کی ترقی میں کیا کردار ادا کرتی ہے؟ مختصر وضاحت کریں۔",
102
  "نظامِ شمسی میں کتنے سیارے ہیں اور سب سے بڑا سیارہ کون سا ہے؟",
103
  ]
104
 
105
  with gr.Blocks(title="Urdu Education & Reasoning", theme=gr.themes.Soft(primary_hue="emerald"), css=CSS) as demo:
106
  gr.HTML(HERO)
107
+ # ── chat front and centre ──
108
+ gr.HTML('<div class="sec"><h2>Try it — اردو میں سوال پوچھیں</h2></div>')
109
+ with gr.Accordion("⚙️ settings", open=False):
110
+ mt = gr.Slider(64, 512, value=256, step=32, label="Max new tokens")
111
+ tp = gr.Slider(0.0, 1.0, value=0.0, step=0.1, label="Temperature")
112
+ gr.ChatInterface(respond, additional_inputs=[mt, tp], examples=[[e] for e in EXAMPLES], cache_examples=False)
113
+ # ── results below the chat ──
114
+ gr.HTML('<div class="sec" style="margin-top:18px"><h2>The result</h2></div>')
115
  gr.HTML(KPI)
116
  with gr.Row():
117
  gr.Image("assets/fig_overall.png", show_label=False, container=False)
 
119
  gr.HTML(APPROACH)
120
  gr.Image("assets/fig_data.png", show_label=False, container=False)
121
  gr.HTML(FINDING)
 
 
 
 
 
122
  gr.HTML(FOOT)
123
 
124
  if __name__ == "__main__":