Update app.py
Browse files
app.py
CHANGED
|
@@ -15,19 +15,18 @@ import os
|
|
| 15 |
|
| 16 |
class BasicAgent:
|
| 17 |
def __init__(self):
|
| 18 |
-
print("✅
|
| 19 |
self.generator = pipeline(
|
| 20 |
"text-generation",
|
| 21 |
-
model="tiiuae/falcon-
|
| 22 |
token=os.getenv("HF_API_KEY")
|
| 23 |
)
|
| 24 |
|
| 25 |
def __call__(self, question: str) -> str:
|
| 26 |
prompt = f"Answer this question accurately: {question}"
|
| 27 |
-
result = self.generator(prompt, max_length=
|
| 28 |
return result[0]['generated_text'].replace(prompt, '').strip()
|
| 29 |
|
| 30 |
-
|
| 31 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
| 32 |
"""
|
| 33 |
Fetches all questions, runs the BasicAgent on them, submits all answers,
|
|
|
|
| 15 |
|
| 16 |
class BasicAgent:
|
| 17 |
def __init__(self):
|
| 18 |
+
print("✅ Using Falcon-RW-1B for fast runs...")
|
| 19 |
self.generator = pipeline(
|
| 20 |
"text-generation",
|
| 21 |
+
model="tiiuae/falcon-rw-1b",
|
| 22 |
token=os.getenv("HF_API_KEY")
|
| 23 |
)
|
| 24 |
|
| 25 |
def __call__(self, question: str) -> str:
|
| 26 |
prompt = f"Answer this question accurately: {question}"
|
| 27 |
+
result = self.generator(prompt, max_length=100, do_sample=False)
|
| 28 |
return result[0]['generated_text'].replace(prompt, '').strip()
|
| 29 |
|
|
|
|
| 30 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
| 31 |
"""
|
| 32 |
Fetches all questions, runs the BasicAgent on them, submits all answers,
|