Download scripts/client_example.py from VeuReu/engine: direct link, hf CLI and curl.
- Browser
- Download file 1.7 kB
-
https://huggingface.co/spaces/VeuReu/engine/resolve/cbee2ade83ef3fb1e5a8d2e3ef0c2f634da2fd5a/scripts/client_example.py
- Command line
-
hf download hf://spaces/VeuReu/engine@cbee2ade83ef3fb1e5a8d2e3ef0c2f634da2fd5a/scripts/client_example.py
-
curl -L -o client_example.py https://huggingface.co/spaces/VeuReu/engine/resolve/cbee2ade83ef3fb1e5a8d2e3ef0c2f634da2fd5a/scripts/client_example.py
1.7 kB
| # ===================================== | |
| # File: client_example.py (opcional) | |
| # ===================================== | |
| import requests | |
| class VeureuEngineClient: | |
| def __init__(self, base_url: str): | |
| self.base = base_url.rstrip("/") | |
| def process_video(self, video_path: str, **kwargs): | |
| with open(video_path, "rb") as f: | |
| files = {"video_file": (Path(video_path).name, f, "video/mp4")} | |
| data = {"config_path": kwargs.get("config_path", "config_veureu.yaml"), | |
| "out_root": kwargs.get("out_root", "results"), | |
| "db_dir": kwargs.get("db_dir", "chroma_db")} | |
| r = requests.post(f"{self.base}/process_video", files=files, data=data, timeout=3600) | |
| r.raise_for_status() | |
| return r.json() | |
| def load_casting(self, faces_dir: str, voices_dir: str, db_dir: str = "chroma_db", drop_collections: bool = False): | |
| data = {"faces_dir": faces_dir, "voices_dir": voices_dir, "db_dir": db_dir, "drop_collections": str(drop_collections)} | |
| r = requests.post(f"{self.base}/load_casting", data=data, timeout=600) | |
| r.raise_for_status(); return r.json() | |
| def refine_narration(self, dialogues_srt: str, frame_descriptions: list, model_url: str, une_guidelines_path: str): | |
| data = { | |
| "dialogues_srt": dialogues_srt, | |
| "frame_descriptions_json": json.dumps(frame_descriptions, ensure_ascii=False), | |
| "model_url": model_url, | |
| "une_guidelines_path": une_guidelines_path, | |
| } | |
| r = requests.post(f"{self.base}/refine_narration", data=data, timeout=600) | |
| r.raise_for_status(); return r.json() |