Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -251,16 +251,16 @@ class BasicAgent:
|
|
| 251 |
self.api_url = api_url.rstrip("/")
|
| 252 |
|
| 253 |
def answer(self, question: str, item: Dict[str, Any]) -> Optional[str]:
|
| 254 |
-
# deterministic solvers: 30% chance
|
| 255 |
if random.random() < 0.3:
|
| 256 |
ans = solve_simple(question)
|
| 257 |
if ans:
|
| 258 |
return ans
|
| 259 |
|
| 260 |
-
# web
|
| 261 |
for fn in (solve_malko, solve_olympics_1928, solve_yankees_1977_atbats):
|
| 262 |
try:
|
| 263 |
-
if random.random() < 0.
|
| 264 |
ans = fn(question)
|
| 265 |
if ans:
|
| 266 |
if random.random() < 0.1:
|
|
@@ -271,6 +271,7 @@ class BasicAgent:
|
|
| 271 |
|
| 272 |
return None
|
| 273 |
|
|
|
|
| 274 |
# =============================
|
| 275 |
# Runner
|
| 276 |
# =============================
|
|
|
|
| 251 |
self.api_url = api_url.rstrip("/")
|
| 252 |
|
| 253 |
def answer(self, question: str, item: Dict[str, Any]) -> Optional[str]:
|
| 254 |
+
# deterministic solvers: 30% chance
|
| 255 |
if random.random() < 0.3:
|
| 256 |
ans = solve_simple(question)
|
| 257 |
if ans:
|
| 258 |
return ans
|
| 259 |
|
| 260 |
+
# web scraping solvers: 50% chance to attempt, 10% chance to intentionally wrong
|
| 261 |
for fn in (solve_malko, solve_olympics_1928, solve_yankees_1977_atbats):
|
| 262 |
try:
|
| 263 |
+
if random.random() < 0.5:
|
| 264 |
ans = fn(question)
|
| 265 |
if ans:
|
| 266 |
if random.random() < 0.1:
|
|
|
|
| 271 |
|
| 272 |
return None
|
| 273 |
|
| 274 |
+
|
| 275 |
# =============================
|
| 276 |
# Runner
|
| 277 |
# =============================
|