updated skeleton with true data
This commit is contained in:
4
worker/core/gpu_detect.py
Normal file
4
worker/core/gpu_detect.py
Normal file
@ -0,0 +1,4 @@
|
||||
import torch
|
||||
|
||||
def device():
|
||||
return 'cuda' if torch.cuda.is_available() else 'cpu'
|
||||
18
worker/core/queue_worker.py
Normal file
18
worker/core/queue_worker.py
Normal file
@ -0,0 +1,18 @@
|
||||
import redis, json, os
|
||||
|
||||
REDIS_HOST=os.environ.get("REDIS_HOST","redis")
|
||||
r=redis.Redis(host=REDIS_HOST, port=6379, db=0)
|
||||
|
||||
QUEUE="tts_queue"
|
||||
RESULT="tts_result"
|
||||
|
||||
def fetch_job():
|
||||
data=r.rpop(QUEUE)
|
||||
if not data:
|
||||
return None
|
||||
return json.loads(data)
|
||||
|
||||
def store_result(job_id:str, audio:bytes, mime:str):
|
||||
key=f"{RESULT}:{job_id}"
|
||||
obj={"audio": audio.hex(), "mime": mime}
|
||||
r.set(key, json.dumps(obj))
|
||||
Reference in New Issue
Block a user