Nav772 commited on
Commit
f7e8813
·
verified ·
1 Parent(s): 211979b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -15,21 +15,21 @@ from transformers import pipeline
15
 
16
  class BasicAgent:
17
  def __init__(self):
18
- print("FLAN-ALPACA-BASE Local Agent initialized.")
19
 
20
  self.pipeline = pipeline(
21
- "text2text-generation",
22
- model="declare-lab/flan-alpaca-base",
23
- tokenizer="declare-lab/flan-alpaca-base",
24
- device=-1 # CPU
25
  )
26
 
27
  def __call__(self, question: str) -> str:
28
  print(f"Agent received question (first 50 chars): {question[:50]}...")
29
 
30
  try:
31
- prompt = f"### Instruction:\n{question.strip()}\n\n### Response:"
32
- result = self.pipeline(prompt, max_new_tokens=128, temperature=0.5)
33
  answer = result[0]["generated_text"]
34
  return answer.strip()
35
  except Exception as e:
 
15
 
16
  class BasicAgent:
17
  def __init__(self):
18
+ print("Falcon-RW-1B Local Agent initialized.")
19
 
20
  self.pipeline = pipeline(
21
+ "text-generation",
22
+ model="tiiuae/falcon-rw-1b",
23
+ tokenizer="tiiuae/falcon-rw-1b",
24
+ device=-1 # CPU only
25
  )
26
 
27
  def __call__(self, question: str) -> str:
28
  print(f"Agent received question (first 50 chars): {question[:50]}...")
29
 
30
  try:
31
+ prompt = f"{question.strip()}"
32
+ result = self.pipeline(prompt, max_new_tokens=128, temperature=0.7)
33
  answer = result[0]["generated_text"]
34
  return answer.strip()
35
  except Exception as e: