Spaces:
Runtime error
Runtime error
File size: 1,122 Bytes
cf2a034 5e85956 | 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 33 34 35 36 37 38 39 40 41 42 43 44 45 | 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) |