""" ================================================================= DERMASCAN-AI — Professional Medical UI Production Grade Healthcare Interface ================================================================= """ import json import streamlit as st import requests from PIL import Image from pathlib import Path # Import components from components.header import render_header from components.sidebar import render_sidebar from components.result_card import render_severity_banner, render_metrics, TIER_ICONS from components.confidence_chart import render_confidence_chart from components.care_advice_card import render_care_advice from components.hospital_map import render_hospital_map # ═══════════════════════════════════════════════════════════ # PAGE CONFIG # ═══════════════════════════════════════════════════════════ st.set_page_config( page_title="DermaScan AI | Advanced Dermatology Analysis", page_icon="🏥", layout="wide", initial_sidebar_state="expanded", ) API_URL = "http://localhost:8000" # ═══════════════════════════════════════════════════════════ # LOAD EXTERNAL DATA & STYLES # ═══════════════════════════════════════════════════════════ config_dir = Path(__file__).parent.parent / "configs" with open(config_dir / "india_cities.json", "r", encoding="utf-8") as f: STATE_CITIES = json.load(f) # Load CSS css_file = Path(__file__).parent / "assets" / "style.css" with open(css_file, "r", encoding="utf-8") as f: st.markdown(f"", unsafe_allow_html=True) # Remove tooltips with JavaScript st.markdown(""" """, unsafe_allow_html=True) # ═══════════════════════════════════════════════════════════ # SIDEBAR # ═══════════════════════════════════════════════════════════ selected_state, selected_city = render_sidebar(STATE_CITIES) # ═══════════════════════════════════════════════════════════ # HEADER # ═══════════════════════════════════════════════════════════ render_header() # ═══════════════════════════════════════════════════════════ # UPLOAD SECTION # ═══════════════════════════════════════════════════════════ uploaded_file = st.file_uploader( "Upload a skin image for analysis", type=["jpg", "jpeg", "png"], ) if uploaded_file: img_col, action_col = st.columns([1, 2]) with img_col: image = Image.open(uploaded_file) st.markdown('
✓ Use a clear, well-lit close-up photo
✓ Center the affected area in the frame
✓ Keep camera 10-15 cm from the skin
✓ Avoid shadows and reflections
✓ Use natural lighting when possible
{result.get("description", "")}
' f'' f'⏰ {result.get("urgency_message", "")}
' f"{result.get("confidence_message", "")}
' f"Other possible conditions to consider:
' for d in diff: d_icon = TIER_ICONS.get(d.get("tier", ""), "⚪") d_prob = d.get("probability", 0) diff_html += ( f'' f'⚡ Analysis completed in {inf_t:.2f}s | 🧠 EfficientNet-B3 | 🏥 DermaScan AI v1.0' f'
', unsafe_allow_html=True ) elif not uploaded_file: st.markdown( 'Our advanced AI system will analyze the image, identify potential conditions, " "provide personalized care recommendations, and help you locate nearby medical facilities.
" ""
"🏥 DermaScan AI | 🧠 EfficientNet-B3 Architecture | 📊 HAM10000 + DermNet Dataset
"
"🔬 13 Skin Conditions | 🎯 96% AUC-ROC Accuracy | ⚡ Real-time Analysis
"
"🛠️ Built with PyTorch • FastAPI • Streamlit
"
"For educational and research purposes only. Not a substitute for professional medical advice."
"