Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,7 +5,6 @@ import os
|
|
| 5 |
import requests
|
| 6 |
import urllib.parse
|
| 7 |
import time
|
| 8 |
-
import spaces
|
| 9 |
from huggingface_hub import HfApi, InferenceClient
|
| 10 |
|
| 11 |
HF_TOKEN = os.getenv("HF_WRITE_TOKEN")
|
|
@@ -46,7 +45,10 @@ def generate_ai_image(keyword, chunk_id):
|
|
| 46 |
# TIER 3: Jika semua gagal, return None (FFmpeg akan buat layar hitam)
|
| 47 |
return None
|
| 48 |
|
| 49 |
-
|
|
|
|
|
|
|
|
|
|
| 50 |
def render_worker(json_data):
|
| 51 |
try:
|
| 52 |
data = json.loads(json_data)
|
|
@@ -54,6 +56,8 @@ def render_worker(json_data):
|
|
| 54 |
text = data.get('text', 'Teks kosong')
|
| 55 |
keyword = data.get('keyword', 'fresh juice')
|
| 56 |
|
|
|
|
|
|
|
| 57 |
# LOGIKA DINAMIS: Kamera & Warna berganti berdasarkan ID potongan
|
| 58 |
cid = int(chunk_id)
|
| 59 |
|
|
|
|
| 5 |
import requests
|
| 6 |
import urllib.parse
|
| 7 |
import time
|
|
|
|
| 8 |
from huggingface_hub import HfApi, InferenceClient
|
| 9 |
|
| 10 |
HF_TOKEN = os.getenv("HF_WRITE_TOKEN")
|
|
|
|
| 45 |
# TIER 3: Jika semua gagal, return None (FFmpeg akan buat layar hitam)
|
| 46 |
return None
|
| 47 |
|
| 48 |
+
|
| 49 |
+
# HAPUS BARIS INI: import spaces (di bagian atas file)
|
| 50 |
+
# HAPUS BARIS INI: @spaces.GPU
|
| 51 |
+
|
| 52 |
def render_worker(json_data):
|
| 53 |
try:
|
| 54 |
data = json.loads(json_data)
|
|
|
|
| 56 |
text = data.get('text', 'Teks kosong')
|
| 57 |
keyword = data.get('keyword', 'fresh juice')
|
| 58 |
|
| 59 |
+
# ... (Sisa kode di bawahnya tetap sama persis, jangan diubah) ...
|
| 60 |
+
|
| 61 |
# LOGIKA DINAMIS: Kamera & Warna berganti berdasarkan ID potongan
|
| 62 |
cid = int(chunk_id)
|
| 63 |
|