Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -15,21 +15,21 @@ from transformers import pipeline
|
|
| 15 |
|
| 16 |
class BasicAgent:
|
| 17 |
def __init__(self):
|
| 18 |
-
print("
|
| 19 |
|
| 20 |
self.pipeline = pipeline(
|
| 21 |
-
"
|
| 22 |
-
model="
|
| 23 |
-
tokenizer="
|
| 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"
|
| 32 |
-
result = self.pipeline(prompt, max_new_tokens=128, temperature=0.
|
| 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:
|