CoolFace
Apppublic

Jaswin-27/MetaXSCALER_Hackathon

sourceHugging Faceupdated 6mo agoView on Hugging Face
0likes
inference.py33 linesDownload Raw Back to root
1import requests
2import os
3
4API_BASE_URL = os.getenv("API_BASE_URL", "http://127.0.0.1:8000")
5
6def run():
7    print("[START]")
8
9    # RESET
10    res = requests.post(f"{API_BASE_URL}/reset")
11    state = res.json()
12
13    print("[STEP] reset:", state)
14
15    done = False
16    step_count = 0
17
18    while not done and step_count < 10:
19        action = {"type": "work"}
20
21        res = requests.post(f"{API_BASE_URL}/step", json=action)
22        result = res.json()
23
24        print("[STEP]", result)
25
26        done = result["done"]
27        step_count += 1
28
29    print("[END]")
30
31
32if __name__ == "__main__":
33    run()