Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| from utils.model_loader import load_model_and_config, load_ui_text | |
| from tabs.single_prediction import create_single_prediction_tab | |
| from tabs.batch_processing import create_batch_processing_tab | |
| # loadign model | |
| config = load_model_and_config() | |
| intro_md, about_md = load_ui_text() | |
| model = config['model'] | |
| class_names = config['class_names'] | |
| disease_db = config['disease_db'] | |
| device = config['device'] | |
| # Custom CSS | |
| custom_css = """ | |
| .gradio-container { | |
| font-family: 'Arial', sans-serif; | |
| } | |
| .output-class { | |
| font-size: 16px; | |
| } | |
| """ | |
| # Create Gradio Interface | |
| with gr.Blocks(css=custom_css, theme=gr.themes.Soft()) as demo: | |
| # Intro | |
| gr.Markdown(intro_md) | |
| # Tab 1: Single Image Prediction | |
| with gr.Tab("Single Image Prediction"): | |
| create_single_prediction_tab(model, class_names, disease_db, device) | |
| # Tab 2: Batch Processing | |
| with gr.Tab("Batch Processing"): | |
| create_batch_processing_tab(model, class_names, device) | |
| # Tab 3: About | |
| with gr.Tab("About"): | |
| gr.Markdown(about_md) | |
| demo.launch(server_name="0.0.0.0", server_port=7860) |