from fastapi import FastAPI, UploadFile, File from fastapi.responses import FileResponse import os import uuid from utils import generate_sample_video, combine_video_audio app = FastAPI() @app.get("/") async def root(): return {"message": "FastAPI + MoviePy on Hugging Face is working."} @app.post("/generate") async def generate(): output_path = generate_sample_video() return FileResponse(output_path, media_type="video/mp4", filename=os.path.basename(output_path)) @app.post("/combine") async def combine(video_file: UploadFile = File(...), audio_file: UploadFile = File(...)): output_path = await combine_video_audio(video_file, audio_file) return FileResponse(output_path, media_type="video/mp4", filename=os.path.basename(output_path)) import sys print(sys.path) try: import moviepy.editor print("✅ MoviePy installed") except Exception as e: print(e)