Update app.py
Browse files
app.py
CHANGED
|
@@ -241,7 +241,7 @@ def generate_video():
|
|
| 241 |
data = None
|
| 242 |
print(raw_body)
|
| 243 |
|
| 244 |
-
|
| 245 |
return jsonify({"error": "No input data provided"}), 400
|
| 246 |
|
| 247 |
# Try to detect if input is JSON or plain string
|
|
@@ -258,7 +258,7 @@ def generate_video():
|
|
| 258 |
print("⚙️ Detected raw string input (non-JSON). Parsing manually...")
|
| 259 |
|
| 260 |
# Handle format like: [ [...], [...]] &&& Tamil explanation
|
| 261 |
-
parts = raw_body.split("
|
| 262 |
slides_part = parts[0].strip()
|
| 263 |
extra_info = parts[1].strip() if len(parts) > 1 else ""
|
| 264 |
|
|
@@ -392,7 +392,7 @@ def generate_video():
|
|
| 392 |
|
| 393 |
except subprocess.TimeoutExpired:
|
| 394 |
print("Video rendering timeout")
|
| 395 |
-
return jsonify({"error": "Video rendering timeout (120s)"}), 504
|
| 396 |
except Exception as e:
|
| 397 |
print(f"Error: {str(e)}")
|
| 398 |
traceback.print_exc()
|
|
|
|
| 241 |
data = None
|
| 242 |
print(raw_body)
|
| 243 |
|
| 244 |
+
if not raw_body:
|
| 245 |
return jsonify({"error": "No input data provided"}), 400
|
| 246 |
|
| 247 |
# Try to detect if input is JSON or plain string
|
|
|
|
| 258 |
print("⚙️ Detected raw string input (non-JSON). Parsing manually...")
|
| 259 |
|
| 260 |
# Handle format like: [ [...], [...]] &&& Tamil explanation
|
| 261 |
+
parts = raw_body.split("&&&&&")
|
| 262 |
slides_part = parts[0].strip()
|
| 263 |
extra_info = parts[1].strip() if len(parts) > 1 else ""
|
| 264 |
|
|
|
|
| 392 |
|
| 393 |
except subprocess.TimeoutExpired:
|
| 394 |
print("Video rendering timeout")
|
| 395 |
+
return jsonify({"error": "Video rendering timeout (120s)"}), 504
|
| 396 |
except Exception as e:
|
| 397 |
print(f"Error: {str(e)}")
|
| 398 |
traceback.print_exc()
|