DeekshithN05 commited on
Commit
6257889
·
verified ·
1 Parent(s): f5c297a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -7
app.py CHANGED
@@ -13,22 +13,20 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
13
  # ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
14
  from transformers import pipeline
15
 
16
- from transformers import pipeline
17
-
18
  class BasicAgent:
19
  def __init__(self):
20
- print("Loading smarter model: flan-t5-xl...")
21
  self.pipeline = pipeline(
22
  "text2text-generation",
23
- model="google/flan-t5-xl",
24
- max_new_tokens=256,
25
- temperature=0.2
26
  )
27
  print("Model loaded.")
28
 
29
  def __call__(self, question: str) -> str:
30
  print(f"Received question: {question[:60]}...")
31
-
32
  few_shot_example = (
33
  "Question: List just the vegetables from [milk, eggs, carrots, onions, cookies].\n"
34
  "Answer: carrots, onions\n\n"
@@ -51,6 +49,7 @@ class BasicAgent:
51
 
52
 
53
 
 
54
  def run_and_submit_all( profile: gr.OAuthProfile | None):
55
  """
56
  Fetches all questions, runs the BasicAgent on them, submits all answers,
 
13
  # ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
14
  from transformers import pipeline
15
 
 
 
16
  class BasicAgent:
17
  def __init__(self):
18
+ print("Loading FLAN-T5 base model...")
19
  self.pipeline = pipeline(
20
  "text2text-generation",
21
+ model="google/flan-t5-base",
22
+ max_new_tokens=128,
23
+ temperature=0.3
24
  )
25
  print("Model loaded.")
26
 
27
  def __call__(self, question: str) -> str:
28
  print(f"Received question: {question[:60]}...")
29
+
30
  few_shot_example = (
31
  "Question: List just the vegetables from [milk, eggs, carrots, onions, cookies].\n"
32
  "Answer: carrots, onions\n\n"
 
49
 
50
 
51
 
52
+
53
  def run_and_submit_all( profile: gr.OAuthProfile | None):
54
  """
55
  Fetches all questions, runs the BasicAgent on them, submits all answers,