Spaces:
Running
Running
Chandima Prabhath
commited on
Commit
·
faa3c7c
1
Parent(s):
ed8fee4
Add random seed generation for trivia question prompts to enhance variability in JSON output
Browse files
app.py
CHANGED
@@ -6,6 +6,7 @@ import queue
|
|
6 |
import re
|
7 |
import json
|
8 |
import time
|
|
|
9 |
from fastapi import FastAPI, Request, HTTPException
|
10 |
from fastapi.responses import PlainTextResponse, JSONResponse
|
11 |
from FLUX import generate_image
|
@@ -279,9 +280,10 @@ async def whatsapp_webhook(request: Request):
|
|
279 |
|
280 |
# TRIVIA
|
281 |
if low == "/trivia":
|
|
|
282 |
raw = generate_llm(
|
283 |
-
|
284 |
-
|
285 |
)
|
286 |
def extract_json(text):
|
287 |
import re
|
|
|
6 |
import re
|
7 |
import json
|
8 |
import time
|
9 |
+
import random
|
10 |
from fastapi import FastAPI, Request, HTTPException
|
11 |
from fastapi.responses import PlainTextResponse, JSONResponse
|
12 |
from FLUX import generate_image
|
|
|
280 |
|
281 |
# TRIVIA
|
282 |
if low == "/trivia":
|
283 |
+
randomSeed = random.randint(0, 999999)
|
284 |
raw = generate_llm(
|
285 |
+
(f"Generate a trivia question and answer depening on this randowm seed {randomSeed} in JSON format like this: "
|
286 |
+
"{\"question\": \"What is the capital of France?\", \"answer\": \"Paris\"}")
|
287 |
)
|
288 |
def extract_json(text):
|
289 |
import re
|