ameforge commited on
Commit
6aa55e5
·
verified ·
1 Parent(s): 55d06e0

Dark UI + definition answers (Who is X?) + Kwame Nkrumah example

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -99,6 +99,7 @@ EXAMPLES = [
99
  "When did Ghana become independent?",
100
  "Who was the first president of Senegal?",
101
  "What is the largest city of Nigeria?",
 
102
  "What is the capital of Mars?",
103
  ]
104
 
@@ -109,7 +110,12 @@ def _format(answer, hits, where):
109
  'Ananke has not read anything that answers this question. '
110
  'It refuses rather than inventing an answer.<br><br>'
111
  '<i>Teach it: paste a text or a Wikipedia title in the second tab.</i></div>')
112
- title = answer.title() if answer else "(no short answer)"
 
 
 
 
 
113
  out = (f'<div class="ananke-card"><div class="ans">{title}</div>'
114
  f'<div class="where">Found in {where}.</div>')
115
  for _, sentence, _, source in hits:
 
99
  "When did Ghana become independent?",
100
  "Who was the first president of Senegal?",
101
  "What is the largest city of Nigeria?",
102
+ "Who is Kwame Nkrumah?",
103
  "What is the capital of Mars?",
104
  ]
105
 
 
110
  'Ananke has not read anything that answers this question. '
111
  'It refuses rather than inventing an answer.<br><br>'
112
  '<i>Teach it: paste a text or a Wikipedia title in the second tab.</i></div>')
113
+ if answer == getattr(engine, "DEFINITION", None):
114
+ title = "Here is what it read about it"
115
+ elif answer:
116
+ title = answer.title()
117
+ else:
118
+ title = "No short answer — here is what it read"
119
  out = (f'<div class="ananke-card"><div class="ans">{title}</div>'
120
  f'<div class="where">Found in {where}.</div>')
121
  for _, sentence, _, source in hits: