File size: 1,031 Bytes
cd3538a
 
3c6e988
cd3538a
3c6e988
 
cd3538a
3c6e988
 
 
 
cd3538a
3c6e988
 
cd3538a
 
 
 
 
3c6e988
 
 
cd3538a
 
 
 
 
 
 
3c6e988
cd3538a
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
27
28
29
30
31
32
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
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.inputs.Image(type="pil"),  # Image input
        outputs=gr.outputs.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
gradio_interface().launch(inline=True)