import gradio as gr import numpy as np from fish_feeding import FishFeeding model = FishFeeding() model.load_models() def fish_feeding(images): for i, img in enumerate(images): images[i] = np.array(img, dtype=np.uint8) total_feed, times = model.final_fish_feed(images) return {"total_feed": total_feed, "times": times} inputs = gr.Image(type='numpy', label="Upload fish images") outputs = gr.JSON(label="Fish Feeding Results") app = gr.Interface(fish_feeding, inputs=inputs, outputs=outputs, title="Fish Feeding Predictor") app.launch()