Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion backend/python/pocket-tts/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import signal
import sys
import os
import tempfile
import traceback
import scipy.io.wavfile
import backend_pb2
Expand Down Expand Up @@ -204,7 +205,7 @@ def TTS(self, request, context):
# Save audio to file
output_path = request.dst
if not output_path:
output_path = "/tmp/pocket-tts-output.wav"
output_path = os.path.join(tempfile.gettempdir(), "pocket-tts-output.wav")

# Ensure output directory exists
output_dir = os.path.dirname(output_path)
Expand Down
3 changes: 2 additions & 1 deletion backend/python/tinygrad/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import os
import signal
import sys
import tempfile
import time
from concurrent import futures
from pathlib import Path
Expand Down Expand Up @@ -668,7 +669,7 @@ async def GenerateImage(self, request, context):
)
arr = img_tensor.numpy()
image = Image.fromarray(arr)
dst = request.dst or "/tmp/tinygrad_image.png"
dst = request.dst or os.path.join(tempfile.gettempdir(), "tinygrad_image.png")
image.save(dst)
return backend_pb2.Result(success=True, message=dst)
except Exception as exc:
Expand Down
5 changes: 3 additions & 2 deletions backend/python/vllm-omni/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import io
import json
import gc
import tempfile

from PIL import Image
import torch
Expand Down Expand Up @@ -117,7 +118,7 @@ def _load_video(self, video_path):
# Try base64 decode
try:
timestamp = str(int(time.time() * 1000))
p = f"/tmp/vl-{timestamp}.data"
p = os.path.join(tempfile.gettempdir(), f"vl-{timestamp}.data")
with open(p, "wb") as f:
f.write(base64.b64decode(video_path))
video = VideoAsset(name=p).np_ndarrays
Expand All @@ -137,7 +138,7 @@ def _load_audio(self, audio_path):
audio_data = base64.b64decode(audio_path)
# Save to temp file and load
timestamp = str(int(time.time() * 1000))
p = f"/tmp/audio-{timestamp}.wav"
p = os.path.join(tempfile.gettempdir(), f"audio-{timestamp}.wav")
with open(p, "wb") as f:
f.write(audio_data)
audio_signal, sr = librosa.load(p, sr=16000)
Expand Down
3 changes: 2 additions & 1 deletion backend/python/vllm/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import json
import time
import gc
import tempfile
from typing import List
from PIL import Image

Expand Down Expand Up @@ -602,7 +603,7 @@ def load_video(self, video_path: str):
"""
try:
timestamp = str(int(time.time() * 1000)) # Generate timestamp
p = f"/tmp/vl-{timestamp}.data" # Use timestamp in filename
p = os.path.join(tempfile.gettempdir(), f"vl-{timestamp}.data")
with open(p, "wb") as f:
f.write(base64.b64decode(video_path))
video = VideoAsset(name=p).np_ndarrays
Expand Down
Loading