import gradio as gr import numpy as np import tensorflow as tf # Assuming your model is loaded here model = tf.keras.models.load_model("pain_analysis.h5") def predict(image): image = np.array(image) / 255.0 # Normalize the image # Make predictions using your model here # result = model.predict(image) return result # Change this line to use gr.Image directly iface = gr.Interface( fn=predict, inputs=gr.Image(type="numpy"), # Use gr.Image directly outputs="label" # Specify the output type as needed ) iface.launch()