Spaces:
				
			
			
	
			
			
		Sleeping
		
	
	
	
			
			
	
	
	
	
		
		
		Sleeping
		
	File size: 1,093 Bytes
			
			| 298ef45 80ee116 298ef45 107e914 298ef45 107e914 298ef45 107e914 298ef45 107e914 b1f94d4 298ef45 107e914 | 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 | import gradio as gr
import numpy as np
from tensorflow.keras.models import load_model
from tensorflow.keras.preprocessing.image import img_to_array
# Cargar el modelo .keras
model = load_model('cnn_covid.keras')
# Funci贸n para hacer la predicci贸n
def predict_image(image):
        # Preprocesar la imagen
        img = image.resize((200, 200))  # Redimensionar a 200x200
        img_array = img_to_array(img)
        img_array = np.expand_dims(img_array, axis=0)  # A帽adir dimensi贸n para el batch
        # Realizar la predicci贸n
        prediction = model.predict(img_array)
        # Interpretar la predicci贸n
        result = 'COVID19' if prediction[0][0] < 0.5 else 'NORMAL'
        return result, "If you don't have an image, please download one from this link: https://drive.google.com/drive/folders/1Dr11dKuSlgtWaTzNLRixzB19y588iNib?usp=sharing"
    # Crear la interfaz de Gradio
    iface = gr.Interface(fn=predict_image,inputs=gr.Image(type="pil"), outputs=[gr.Textbox(label="Prediction"), gr.Textbox(label="Download Link")],  live=True)
# Lanzar la interfaz
iface.launch() |