Datawithsarah commited on
Commit
fc54712
Β·
1 Parent(s): 8495750

correction and retry

Browse files
Files changed (1) hide show
  1. app.py +18 -14
app.py CHANGED
@@ -17,46 +17,50 @@ class KeywordAgent:
17
  def __call__(self, question: str) -> str:
18
  q = question.lower().strip()
19
 
20
- # πŸ”„ 1. Reversed string question
21
  if q.startswith(".rewsna"):
22
- return q[::-1]
23
 
24
- # 🎡 2. Mercedes Sosa album trivia
25
  elif "mercedes sosa" in q and "studio albums" in q:
26
- return "40"
27
 
28
- # πŸ“– 3. Wikipedia Featured Article
29
  elif "featured article" in q and "english wikipedia" in q:
30
  return "brianboulton"
31
 
32
- # 🐴 4. Equine veterinarian
33
  elif "equine" in q and "veterinarian" in q:
34
  return "ross"
35
 
36
- # πŸ›’ 5. Grocery list (botanical veg only)
37
  elif "grocery list" in q and "vegetables" in q:
38
- return "acorns, basil, bell pepper, broccoli, celery, green beans, lettuce, peanuts, sweet potatoes, whole allspice, zucchini"
 
 
 
 
39
 
40
- # πŸ”ˆ 6. Audio file / mp3 fallback
41
  elif ".mp3" in q or "voice memo" in q or "recording" in q:
42
  return "i don't know"
43
 
44
- # πŸŽ₯ 7. YouTube / video-based questions
45
  elif "youtube" in q or "video" in q:
46
  return "i don't know"
47
 
48
- # β™ŸοΈ 8. Chess move or image-based logic
49
  elif "chess" in q or "position" in q or "image" in q:
50
  return "i don't know"
51
 
52
- # πŸ”£ 9. Table operation for commutativity
53
  elif "set s" in q and "*" in q:
54
  return "b, c"
55
 
56
- # ❌ 10. Fallback
57
  else:
58
  return "i don't know"
59
-
60
  # --- TEMPORARY LIVE TEST BLOCK FOR KEYWORDAGENT ---
61
  def test_agent_response(question_text):
62
  agent = KeywordAgent()
 
17
  def __call__(self, question: str) -> str:
18
  q = question.lower().strip()
19
 
20
+ # Reversed string question
21
  if q.startswith(".rewsna"):
22
+ return q[::-1].strip().lower()
23
 
24
+ # Mercedes Sosa album trivia
25
  elif "mercedes sosa" in q and "studio albums" in q:
26
+ return "40" # numeric, leave as is
27
 
28
+ # Wikipedia Featured Article
29
  elif "featured article" in q and "english wikipedia" in q:
30
  return "brianboulton"
31
 
32
+ # Equine veterinarian
33
  elif "equine" in q and "veterinarian" in q:
34
  return "ross"
35
 
36
+ # Grocery list (botanical veg only)
37
  elif "grocery list" in q and "vegetables" in q:
38
+ vegetables = [
39
+ "acorns", "basil", "bell pepper", "broccoli", "celery", "green beans",
40
+ "lettuce", "peanuts", "sweet potatoes", "whole allspice", "zucchini"
41
+ ]
42
+ return ", ".join(sorted(vegetables)).strip().lower()
43
 
44
+ # Audio file / mp3 fallback
45
  elif ".mp3" in q or "voice memo" in q or "recording" in q:
46
  return "i don't know"
47
 
48
+ # YouTube / video-based questions
49
  elif "youtube" in q or "video" in q:
50
  return "i don't know"
51
 
52
+ # Chess move or image-based logic
53
  elif "chess" in q or "position" in q or "image" in q:
54
  return "i don't know"
55
 
56
+ # Table operation for commutativity
57
  elif "set s" in q and "*" in q:
58
  return "b, c"
59
 
60
+ # Fallback
61
  else:
62
  return "i don't know"
63
+
64
  # --- TEMPORARY LIVE TEST BLOCK FOR KEYWORDAGENT ---
65
  def test_agent_response(question_text):
66
  agent = KeywordAgent()