Update app.py
Browse files
app.py
CHANGED
|
@@ -12,15 +12,6 @@ HF_TOKEN = os.getenv("HF_TOKEN", None)
|
|
| 12 |
|
| 13 |
# --- Basic Agent Definition ---
|
| 14 |
# ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
|
| 15 |
-
class BasicAgent:
|
| 16 |
-
def __init__(self):
|
| 17 |
-
print("BasicAgent initialized.")
|
| 18 |
-
def __call__(self, question: str) -> str:
|
| 19 |
-
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 20 |
-
fixed_answer = "This is a default answer."
|
| 21 |
-
print(f"Agent returning fixed answer: {fixed_answer}")
|
| 22 |
-
return fixed_answer
|
| 23 |
-
|
| 24 |
class BasicAgent:
|
| 25 |
def __init__(self):
|
| 26 |
# initialize HF inference pipeline once
|
|
@@ -30,6 +21,7 @@ class BasicAgent:
|
|
| 30 |
"text-generation",
|
| 31 |
model="gpt2", # or your chosen model
|
| 32 |
tokenizer="gpt2",
|
|
|
|
| 33 |
device=-1, # CPU; adjust if GPU
|
| 34 |
use_auth_token=HF_TOKEN,
|
| 35 |
)
|
|
|
|
| 12 |
|
| 13 |
# --- Basic Agent Definition ---
|
| 14 |
# ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
class BasicAgent:
|
| 16 |
def __init__(self):
|
| 17 |
# initialize HF inference pipeline once
|
|
|
|
| 21 |
"text-generation",
|
| 22 |
model="gpt2", # or your chosen model
|
| 23 |
tokenizer="gpt2",
|
| 24 |
+
framework="pt",
|
| 25 |
device=-1, # CPU; adjust if GPU
|
| 26 |
use_auth_token=HF_TOKEN,
|
| 27 |
)
|