Spaces:
Sleeping
Sleeping
File size: 1,255 Bytes
7bc42b8 |
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 31 32 33 34 35 36 37 38 39 40 41 |
import pytest
import torch
from PIL import Image
import numpy as np
import tempfile
import os
@pytest.fixture
def mock_device():
"""Mock device for testing"""
return "cpu"
@pytest.fixture
def sample_medical_text():
"""Sample medical text for testing"""
return """
Patient: John Smith, 45-year-old male
Chief Complaint: Chest pain for 2 hours
History: Patient reports sudden onset of sharp chest pain while at work.
Pain is 7/10 intensity, located substernal, radiating to left arm.
Physical Exam: VS: BP 150/90, HR 110, RR 22, O2 Sat 96% on RA.
Patient appears anxious and diaphoretic.
Assessment: Acute chest pain, rule out myocardial infarction
Plan: EKG, cardiac enzymes, chest X-ray, aspirin 325mg
"""
@pytest.fixture
def sample_image():
"""Create a sample image for OCR testing"""
# Create a simple white image with black text
img = Image.new('RGB', (400, 300), color='white')
return img
@pytest.fixture
def temp_image_file():
"""Create a temporary image file"""
with tempfile.NamedTemporaryFile(suffix='.png', delete=False) as tmp:
img = Image.new('RGB', (400, 300), color='white')
img.save(tmp.name)
yield tmp.name
os.unlink(tmp.name) |