Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,7 +8,6 @@ from PIL import Image
|
|
| 8 |
import pandas as pd
|
| 9 |
from streamlit_lottie import st_lottie
|
| 10 |
import requests
|
| 11 |
-
import time
|
| 12 |
|
| 13 |
# Set page configuration
|
| 14 |
st.set_page_config(page_title="Advanced Dental Disease Detection", page_icon="π¦·", layout="wide")
|
|
@@ -240,43 +239,9 @@ This AI-powered tool assists dental professionals in comprehensive X-ray analysi
|
|
| 240 |
# Read image
|
| 241 |
image = Image.open(uploaded_file)
|
| 242 |
|
| 243 |
-
#
|
| 244 |
-
|
| 245 |
-
analysis_status = st.empty()
|
| 246 |
-
|
| 247 |
-
# Make prediction with detailed progress steps
|
| 248 |
-
with progress_container:
|
| 249 |
-
progress_bar = st.progress(0)
|
| 250 |
-
|
| 251 |
-
# Step 1: Image preprocessing
|
| 252 |
-
analysis_status.write("π Preprocessing image...")
|
| 253 |
-
time.sleep(0.5) # Simulate processing time
|
| 254 |
-
progress_bar.progress(20)
|
| 255 |
-
|
| 256 |
-
# Step 2: Model preparation
|
| 257 |
-
analysis_status.write("βοΈ Preparing model for analysis...")
|
| 258 |
-
time.sleep(0.5)
|
| 259 |
-
progress_bar.progress(40)
|
| 260 |
-
|
| 261 |
-
# Step 3: Running inference
|
| 262 |
-
analysis_status.write("π Running dental condition detection...")
|
| 263 |
results = process_image(image, model)
|
| 264 |
-
progress_bar.progress(70)
|
| 265 |
-
|
| 266 |
-
# Step 4: Processing results
|
| 267 |
-
analysis_status.write("π Processing detection results...")
|
| 268 |
-
time.sleep(0.5)
|
| 269 |
-
progress_bar.progress(90)
|
| 270 |
-
|
| 271 |
-
# Step 5: Generating visualizations
|
| 272 |
-
analysis_status.write("π¨ Generating visualizations...")
|
| 273 |
-
time.sleep(0.5)
|
| 274 |
-
progress_bar.progress(100)
|
| 275 |
-
|
| 276 |
-
# Clear the progress indicators
|
| 277 |
-
time.sleep(0.3)
|
| 278 |
-
progress_container.empty()
|
| 279 |
-
analysis_status.empty()
|
| 280 |
|
| 281 |
if results is not None:
|
| 282 |
# Display original and processed images side by side
|
|
@@ -292,7 +257,6 @@ This AI-powered tool assists dental professionals in comprehensive X-ray analysi
|
|
| 292 |
processed_image = draw_predictions(image, results)
|
| 293 |
st.image(processed_image, use_container_width=True)
|
| 294 |
|
| 295 |
-
# Rest of the code remains the same...
|
| 296 |
# Group predictions by condition
|
| 297 |
condition_groups = group_predictions_by_condition(results)
|
| 298 |
|
|
|
|
| 8 |
import pandas as pd
|
| 9 |
from streamlit_lottie import st_lottie
|
| 10 |
import requests
|
|
|
|
| 11 |
|
| 12 |
# Set page configuration
|
| 13 |
st.set_page_config(page_title="Advanced Dental Disease Detection", page_icon="π¦·", layout="wide")
|
|
|
|
| 239 |
# Read image
|
| 240 |
image = Image.open(uploaded_file)
|
| 241 |
|
| 242 |
+
# Make prediction
|
| 243 |
+
with st.spinner("Analyzing image..."):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 244 |
results = process_image(image, model)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 245 |
|
| 246 |
if results is not None:
|
| 247 |
# Display original and processed images side by side
|
|
|
|
| 257 |
processed_image = draw_predictions(image, results)
|
| 258 |
st.image(processed_image, use_container_width=True)
|
| 259 |
|
|
|
|
| 260 |
# Group predictions by condition
|
| 261 |
condition_groups = group_predictions_by_condition(results)
|
| 262 |
|