File size: 575 Bytes
ad3d110
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import sys

print("Testing model service...")

try:
    from model_service import correct_code_with_ai
except ImportError as e:
    print(f"\nCRITICAL: Missing dependencies. Please run 'pip install -r requirements.txt' in the backend directory.\nError: {e}")
    sys.exit(1)

buggy_code = "def add(a, b): return a - b # Bug: should be +"

print(f"\nInput Code:\n{buggy_code}")

try:
    result = correct_code_with_ai(buggy_code)
    print("\n--- Result ---")
    print(result)
    print("--- End Result ---")
except Exception as e:
    print(f"\nError during inference: {e}")