| """End-to-end smoke test: loads the real models and runs the core pipeline once. |
| Slow (loads the VLM). Run on a GPU: python tests/smoke_e2e.py |
| Validates that the EN rewrite + refactor did not break STT/VLM/TTS. |
| """ |
| import os |
| import sys |
| import time |
|
|
| HERE = os.path.dirname(os.path.abspath(__file__)) |
| IRIS = os.path.dirname(HERE) |
| sys.path.insert(0, IRIS) |
|
|
| from core import stt, tts, vlm |
|
|
| SAMP = os.path.join(IRIS, "..", "viability", "samples") |
|
|
|
|
| def main(): |
| label = os.path.join(SAMP, "label.png") |
| room = os.path.join(SAMP, "indoor.jpg") |
|
|
| t = time.time() |
| pt = vlm.describe(label, "o que diz aqui?", lang="pt") |
| print(f"[describe PT {time.time()-t:.1f}s] {pt}") |
| assert pt.strip(), "empty PT description" |
|
|
| en = vlm.describe(label, "what does it say?", lang="en") |
| print(f"[describe EN] {en}") |
| assert en.strip(), "empty EN description" |
|
|
| base = vlm.describe(room, lang="pt") |
| print(f"[baseline PT] {base}") |
| assert base.strip(), "empty baseline" |
|
|
| wp = tts.synthesize("teste em português", "pt") |
| we = tts.synthesize("english test", "en") |
| print(f"[tts pt] {wp} ({os.path.getsize(wp) if wp else 0} bytes)") |
| print(f"[tts en] {we} ({os.path.getsize(we) if we else 0} bytes)") |
| assert wp and os.path.getsize(wp) > 1000 |
| assert we and os.path.getsize(we) > 1000 |
|
|
| back = stt.transcribe(wp, "pt") |
| print(f"[stt] {back!r}") |
| assert back.strip(), "empty STT" |
|
|
| print("\nSMOKE E2E OK ✅") |
|
|
|
|
| if __name__ == "__main__": |
| main() |
|
|