DeekshithN05 commited on
Commit
1bf97c7
·
verified ·
1 Parent(s): 3b8d66e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -9
app.py CHANGED
@@ -9,15 +9,14 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
9
 
10
  class BasicAgent:
11
  def __init__(self):
12
- print("🔄 Loading model: flan-alpaca-base...")
13
  self.pipeline = pipeline(
14
- "text-generation",
15
- model="HuggingFaceH4/zephyr-7b-beta",
16
- max_new_tokens=256,
17
- temperature=0.3
18
- )
19
-
20
- print("✅ Model loaded.")
21
 
22
  def __call__(self, question: str, task_id: str = None) -> str:
23
  question_lower = question.lower()
@@ -39,10 +38,11 @@ class BasicAgent:
39
  "Question: List just the vegetables from [milk, eggs, carrots, onions, cookies].\n"
40
  "Answer: carrots, onions\n\n"
41
  )
42
- prompt = few_shot + f"Please answer this question step by step:\n{question}"
43
  result = self.pipeline(prompt)[0]["generated_text"]
44
  return result.strip().split("Answer:")[-1].strip()
45
 
 
46
  def search_wikipedia(self, question: str) -> str:
47
  import wikipedia
48
  try:
 
9
 
10
  class BasicAgent:
11
  def __init__(self):
12
+ print("Loading flan-t5-base...")
13
  self.pipeline = pipeline(
14
+ "text2text-generation",
15
+ model="google/flan-t5-base",
16
+ max_new_tokens=128,
17
+ temperature=0.3
18
+ )
19
+ print("Model loaded.")
 
20
 
21
  def __call__(self, question: str, task_id: str = None) -> str:
22
  question_lower = question.lower()
 
38
  "Question: List just the vegetables from [milk, eggs, carrots, onions, cookies].\n"
39
  "Answer: carrots, onions\n\n"
40
  )
41
+ prompt = f"Please solve the following step-by-step and return only the final answer:\n{question}"
42
  result = self.pipeline(prompt)[0]["generated_text"]
43
  return result.strip().split("Answer:")[-1].strip()
44
 
45
+
46
  def search_wikipedia(self, question: str) -> str:
47
  import wikipedia
48
  try: