Spaces:
Running
Running
feat: final production backend with dynamic model discovery and stable health checks
Browse files- test_model.py +21 -0
test_model.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import sys
|
| 2 |
+
|
| 3 |
+
print("Testing model service...")
|
| 4 |
+
|
| 5 |
+
try:
|
| 6 |
+
from model_service import correct_code_with_ai
|
| 7 |
+
except ImportError as e:
|
| 8 |
+
print(f"\nCRITICAL: Missing dependencies. Please run 'pip install -r requirements.txt' in the backend directory.\nError: {e}")
|
| 9 |
+
sys.exit(1)
|
| 10 |
+
|
| 11 |
+
buggy_code = "def add(a, b): return a - b # Bug: should be +"
|
| 12 |
+
|
| 13 |
+
print(f"\nInput Code:\n{buggy_code}")
|
| 14 |
+
|
| 15 |
+
try:
|
| 16 |
+
result = correct_code_with_ai(buggy_code)
|
| 17 |
+
print("\n--- Result ---")
|
| 18 |
+
print(result)
|
| 19 |
+
print("--- End Result ---")
|
| 20 |
+
except Exception as e:
|
| 21 |
+
print(f"\nError during inference: {e}")
|