HilmiZr's picture
updated: app.py
8219a28
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from pathlib import Path
import streamlit as st
import config
from utils import load_model, infer_uploaded_image
# setting page layout
st.set_page_config(
page_title="🧖‍♀️💆‍♀️✨CLARIS Skin Analyzer",
page_icon="📷",
layout="wide",
initial_sidebar_state="expanded"
)
# main page heading
st.title("🧖‍♀️💆‍♀️✨CLARIS Skin Analyzer")
# sidebar
st.sidebar.header("Model Configuration")
# load model options from config
model_type = st.sidebar.selectbox("Select Model", config.DETECTION_MODEL_LIST)
confidence = float(st.sidebar.slider("Model Confidence Threshold", 30, 100, 50)) / 100
# construct model path
model_path = Path(config.DETECTION_MODEL_DIR, model_type)
# load pretrained DL model
try:
model = load_model(model_path)
except Exception as e:
st.error(f"Unable to load model. Error: {e}")
# perform image inference
infer_uploaded_image(confidence, model)