| import configparser | |
| import gradio as gr | |
| from image_processor import ImageProcessor | |
| def main(): | |
| config = configparser.ConfigParser() | |
| config.read('config.cfg') | |
| host_ip_address = str(config['SERVER']['host_ip_address']) | |
| port_number = int(config['SERVER']['port_number']) | |
| image_processor_obj = ImageProcessor() | |
| interface = gr.Interface( | |
| fn=image_processor_obj.process_image, | |
| inputs=gr.Image(type="pil"), | |
| outputs=[ | |
| gr.DataFrame(headers=['label', 'prob']), | |
| ], | |
| title="Image Classification Demo", | |
| description="Upload an image to see the results of its classification.", | |
| allow_flagging="never" | |
| ) | |
| interface.launch(server_name=host_ip_address, server_port=port_number) | |
| main() | |