Spaces:
Runtime error
Runtime error
Commit
·
89fbf1a
1
Parent(s):
0536cec
♻️ Refactor Trivia function parameters to use string types for Category and Difficulty
Browse files
app.py
CHANGED
|
@@ -352,7 +352,7 @@ def Plot(GiveExamplePrompt: bool = True) -> list[str]:
|
|
| 352 |
else:
|
| 353 |
return [Prompt, '']
|
| 354 |
|
| 355 |
-
def Trivia(Category:
|
| 356 |
CategoryParam = f'&category={Categories[Category]}' if Category != 'Any Category' else ''
|
| 357 |
DifficultyParam = f'&difficulty={Difficulties[Difficulty]}' if Difficulty != 'Any Difficulty' else ''
|
| 358 |
Raw = requests.get(f'https://opentdb.com/api.php?amount=1{CategoryParam}{DifficultyParam}&encode=base64', headers=Headers)
|
|
|
|
| 352 |
else:
|
| 353 |
return [Prompt, '']
|
| 354 |
|
| 355 |
+
def Trivia(Category: str, Difficulty: str) -> str:
|
| 356 |
CategoryParam = f'&category={Categories[Category]}' if Category != 'Any Category' else ''
|
| 357 |
DifficultyParam = f'&difficulty={Difficulties[Difficulty]}' if Difficulty != 'Any Difficulty' else ''
|
| 358 |
Raw = requests.get(f'https://opentdb.com/api.php?amount=1{CategoryParam}{DifficultyParam}&encode=base64', headers=Headers)
|