import streamlit as st import google.generativeai as genai from PIL import Image # إعدادات الصفحة st.set_page_config(page_title="Accudent", page_icon="🦷") st.title("🦷 Accudent: Smart Endo Agent") st.write("AI-assisted Digital Scaling (Prototype v1.0)") # Sidebar with st.sidebar: st.header("Settings") api_key = st.text_input("Enter Gemini API Key:", type="password") st.info("Get your key from: https://aistudio.google.com/app/apikey") # رفع الصورة uploaded_file = st.file_uploader("Upload Dental X-ray...", type=["jpg", "jpeg", "png"]) if uploaded_file: image = Image.open(uploaded_file) st.image(image, caption="Uploaded X-ray", use_container_width=True) if st.button("Analyze & Measure"): if not api_key: st.error("Please enter your API Key first!") else: try: genai.configure(api_key=api_key) model = genai.GenerativeModel('gemini-1.5-pro') with st.spinner("AI is calculating measurements..."): prompt = "Analyze this dental X-ray. 1. Identify 1.8mm metal reference. 2. Calculate Working Length. 3. Output in mm." response = model.generate_content([prompt, image]) st.success("Analysis Complete!") st.write(response.text) except Exception as e: st.error(f"Error: {e}") else: st.info("Waiting for X-ray upload...")