import streamlit as st import gradio as gr from inference import predict_image # Importing the predict_image function from inference.py # Streamlit UI st.title("Fish Image Classification with AI") st.markdown(""" This app allows you to upload a fish image, and it will classify the fish into one of the categories using two different AI models: - **ResNet18** - **MobileNetV2** Upload an image below to get predictions. """) # Gradio Interface for prediction def gradio_interface(): # This will load the models and use Gradio's interface to interact gradio_interface = gr.Interface( fn=predict_image, # Function that performs inference inputs=gr.Image(type="pil"), # Image input (gr.Image in Gradio v3.x) outputs=gr.JSON(), # Output format (JSON with predictions) live=True, title="Fish Image Classification", description="Classify fish images using AI models (ResNet18, MobileNetV2).", ) return gradio_interface # Add the Gradio Interface inside the Streamlit app gradio_interface().launch(inline=True)