File size: 562 Bytes
03a7eb9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import httpx


code = """#include <stdio.h>

int main() {
    int n, tq;
    printf("Enter number of processes: ");
    scanf("%d", &n);
    return 0;
}
"""

b = "http://127.0.0.1:7860"
httpx.post(f"{b}/reset", json={"task_id": "easy-1"}, timeout=30)
s = httpx.post(f"{b}/step", json={"proposed_fix": code}, timeout=60).json()
print(
    {
        "reward": s.get("reward"),
        "done": s.get("done"),
        "error_log": s.get("observation", {}).get("error_log", "")[:240],
        "test_results": s.get("observation", {}).get("test_results", ""),
    }
)