Spaces:
				
			
			
	
			
			
					
		Running
		
	
	
	
			
			
	
	
	
	
		
		
					
		Running
		
	
		GitHub Actions
		
	commited on
		
		
					Commit 
							
							·
						
						2b57106
	
1
								Parent(s):
							
							f181ff4
								
Auto-deploy from GitHub
Browse files- api/.DS_Store → .DS_Store +0 -0
 - api/.gitattributes → .gitattributes +0 -0
 - README.md +0 -14
 - api/app.py → app.py +1 -1
 - api/detect.py → detect.py +1 -3
 - {api/models → models}/.DS_Store +0 -0
 - {api/models → models}/DetectsmallTest1.pt +0 -0
 - {api/models → models}/checkpoints/model_checkpoint_best_city.keras +0 -0
 - {api/models → models}/checkpoints/test_checkpoint1.keras +0 -0
 - {api/models → models}/scalers/scaler_dyn_global.pkl +0 -0
 - {api/models → models}/scalers/scaler_static_global.pkl +0 -0
 - {api/models → models}/scalers/scaler_target_global.pkl +0 -0
 - api/predict.py → predict.py +0 -0
 - api/requirements.txt → requirements.txt +0 -0
 
    	
        api/.DS_Store → .DS_Store
    RENAMED
    
    | 
         
            File without changes
         
     | 
    	
        api/.gitattributes → .gitattributes
    RENAMED
    
    | 
         
            File without changes
         
     | 
    	
        README.md
    DELETED
    
    | 
         @@ -1,14 +0,0 @@ 
     | 
|
| 1 | 
         
            -
            ---
         
     | 
| 2 | 
         
            -
            title: PreviDengueAPI
         
     | 
| 3 | 
         
            -
            repository: https://github.com/IonMateus/PreviDengue
         
     | 
| 4 | 
         
            -
            subdirectory: api/
         
     | 
| 5 | 
         
            -
            emoji: 🦟
         
     | 
| 6 | 
         
            -
            colorFrom: blue
         
     | 
| 7 | 
         
            -
            colorTo: green
         
     | 
| 8 | 
         
            -
            sdk: docker
         
     | 
| 9 | 
         
            -
            pinned: false
         
     | 
| 10 | 
         
            -
            license: mit
         
     | 
| 11 | 
         
            -
            short_description: 'Identificação de Focos e Surtos de Dengue'
         
     | 
| 12 | 
         
            -
            ---
         
     | 
| 13 | 
         
            -
             
     | 
| 14 | 
         
            -
            Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
         
     | 
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
    	
        api/app.py → app.py
    RENAMED
    
    | 
         @@ -23,7 +23,7 @@ predictor: DenguePredictor = None 
     | 
|
| 23 | 
         | 
| 24 | 
         
             
            app = FastAPI()
         
     | 
| 25 | 
         | 
| 26 | 
         
            -
            # ---  
     | 
| 27 | 
         
             
            @app.on_event("startup")
         
     | 
| 28 | 
         
             
            async def startup_event():
         
     | 
| 29 | 
         
             
                global detector, predictor
         
     | 
| 
         | 
|
| 23 | 
         | 
| 24 | 
         
             
            app = FastAPI()
         
     | 
| 25 | 
         | 
| 26 | 
         
            +
            # --- evento de startup para carregar os modelos ---
         
     | 
| 27 | 
         
             
            @app.on_event("startup")
         
     | 
| 28 | 
         
             
            async def startup_event():
         
     | 
| 29 | 
         
             
                global detector, predictor
         
     | 
    	
        api/detect.py → detect.py
    RENAMED
    
    | 
         @@ -17,10 +17,9 @@ class DengueDetector: 
     | 
|
| 17 | 
         
             
                def detect_image(self, image_bytes):
         
     | 
| 18 | 
         
             
                    # Carregar imagem da memória
         
     | 
| 19 | 
         
             
                    img = Image.open(BytesIO(image_bytes)).convert("RGB")
         
     | 
| 20 | 
         
            -
                    img_np = np.array(img)   
     | 
| 21 | 
         
             
                    height, width = img_np.shape[:2]
         
     | 
| 22 | 
         | 
| 23 | 
         
            -
                    # Detectar objetos
         
     | 
| 24 | 
         
             
                    results = self.model(img_np)
         
     | 
| 25 | 
         
             
                    result = results[0]
         
     | 
| 26 | 
         
             
                    boxes = result.boxes
         
     | 
| 
         @@ -29,7 +28,6 @@ class DengueDetector: 
     | 
|
| 29 | 
         
             
                    class_names = [self.names[int(cls)] for cls in class_ids]
         
     | 
| 30 | 
         
             
                    counts = Counter(class_names)
         
     | 
| 31 | 
         | 
| 32 | 
         
            -
                    # Construir lista de detecções
         
     | 
| 33 | 
         
             
                    detections = []
         
     | 
| 34 | 
         
             
                    for i in range(len(boxes)):
         
     | 
| 35 | 
         
             
                        x1, y1, x2, y2 = map(float, boxes.xyxy[i])
         
     | 
| 
         | 
|
| 17 | 
         
             
                def detect_image(self, image_bytes):
         
     | 
| 18 | 
         
             
                    # Carregar imagem da memória
         
     | 
| 19 | 
         
             
                    img = Image.open(BytesIO(image_bytes)).convert("RGB")
         
     | 
| 20 | 
         
            +
                    img_np = np.array(img)  
         
     | 
| 21 | 
         
             
                    height, width = img_np.shape[:2]
         
     | 
| 22 | 
         | 
| 
         | 
|
| 23 | 
         
             
                    results = self.model(img_np)
         
     | 
| 24 | 
         
             
                    result = results[0]
         
     | 
| 25 | 
         
             
                    boxes = result.boxes
         
     | 
| 
         | 
|
| 28 | 
         
             
                    class_names = [self.names[int(cls)] for cls in class_ids]
         
     | 
| 29 | 
         
             
                    counts = Counter(class_names)
         
     | 
| 30 | 
         | 
| 
         | 
|
| 31 | 
         
             
                    detections = []
         
     | 
| 32 | 
         
             
                    for i in range(len(boxes)):
         
     | 
| 33 | 
         
             
                        x1, y1, x2, y2 = map(float, boxes.xyxy[i])
         
     | 
    	
        {api/models → models}/.DS_Store
    RENAMED
    
    | 
         
            File without changes
         
     | 
    	
        {api/models → models}/DetectsmallTest1.pt
    RENAMED
    
    | 
         
            File without changes
         
     | 
    	
        {api/models → models}/checkpoints/model_checkpoint_best_city.keras
    RENAMED
    
    | 
         
            File without changes
         
     | 
    	
        {api/models → models}/checkpoints/test_checkpoint1.keras
    RENAMED
    
    | 
         
            File without changes
         
     | 
    	
        {api/models → models}/scalers/scaler_dyn_global.pkl
    RENAMED
    
    | 
         
            File without changes
         
     | 
    	
        {api/models → models}/scalers/scaler_static_global.pkl
    RENAMED
    
    | 
         
            File without changes
         
     | 
    	
        {api/models → models}/scalers/scaler_target_global.pkl
    RENAMED
    
    | 
         
            File without changes
         
     | 
    	
        api/predict.py → predict.py
    RENAMED
    
    | 
         
            File without changes
         
     | 
    	
        api/requirements.txt → requirements.txt
    RENAMED
    
    | 
         
            File without changes
         
     |