| import gradio as gr | |
| from utils import get_captions | |
| # Create a Gradio interface | |
| iface = gr.Interface( | |
| fn=get_captions, # Function to be called on user input | |
| inputs=gr.Image( | |
| width=416, height=416, | |
| type="pil", image_mode='RGB', label="Upload Image" | |
| ), | |
| outputs=gr.Textbox( | |
| label="Response from AI Model: ", | |
| ), | |
| examples = ['examples/HorseRide.jpg','examples/Car.jpg'] | |
| ) | |
| # Launch the Gradio app | |
| iface.launch() |