Spaces:
Build error
Build error
faizr206 commited on
Commit ·
6d2efe1
1
Parent(s): 021ff9d
file upload change
Browse files180 unmodified lines181182183184185186187188189190191192193194195180 unmodified linesreturn mp4.read_bytes(), png_pathdef _upload_image_to_gemini(png_path: Path):"""Use the Files API to upload an image and return a file part for contents."""if not client or not png_path or not png_path.exists():return Nonelimiter.acquire()# The SDK exposes client.files.upload(path=...)# (See "Using files" + "Image understanding" docs)file_ref = client.files.upload(path=str(png_path))return file_refdef llm_generate_manim_code(prompt: str, previous_code: Optional[str] = None) -> str:"""First-pass generation (capture-aware)."""if not client:180 unmodified lines181182183184185186187188189190191192193194195196197180 unmodified linesreturn mp4.read_bytes(), png_pathdef _upload_image_to_gemini(png_path: Path):"""Upload an image to Gemini Files API and return the file reference."""if not client or not png_path or not png_path.exists():return Nonelimiter.acquire()# The current SDK expects a positional argument, not a keyword.# You can pass either a file object or a string path.with open(png_path, "rb") as f:file_ref = client.files.upload(f)return file_refdef llm_generate_manim_code(prompt: str, previous_code: Optional[str] = None) -> str:"""First-pass generation (capture-aware)."""if not client:
app/main.py+6-4