File size: 809 Bytes
287e21d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import asyncio
from app import run_analysis_fn, create_case_fn, upload_photos_fn, ensure_init
from backend.app.db.database import db

async def setup():
    ensure_init()
    # Create a case
    msg, _ = create_case_fn("TEST-001", "Officer John", "NYC", "2023-01-01", "Notes")
    # Add a mock photo
    import os
    from PIL import Image
    os.makedirs("test_photos", exist_ok=True)
    img_path = "test_photos/mock.jpg"
    Image.new("RGB", (100, 100)).save(img_path)
    
    # upload
    upload_photos_fn(1, [img_path])
    
    # Run analysis
    try:
        res = run_analysis_fn(1)
        print("Analysis result:", res)
    except Exception as e:
        print("Error during analysis:", e)
        import traceback
        traceback.print_exc()

if __name__ == "__main__":
    asyncio.run(setup())