File size: 1,529 Bytes
f7a11cd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
"""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  # noqa: E402

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")  # live-mode baseline
    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()