updated the UI code ✅✅
Browse files- mediSync/app.py +34 -0
mediSync/app.py
CHANGED
@@ -7,6 +7,40 @@ import requests
|
|
7 |
import gradio as gr
|
8 |
import matplotlib.pyplot as plt
|
9 |
from PIL import Image
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
# Import configuration for end consultation logic
|
12 |
try:
|
|
|
7 |
import gradio as gr
|
8 |
import matplotlib.pyplot as plt
|
9 |
from PIL import Image
|
10 |
+
import logging
|
11 |
+
import os
|
12 |
+
import sys
|
13 |
+
import tempfile
|
14 |
+
from pathlib import Path
|
15 |
+
|
16 |
+
import gradio as gr
|
17 |
+
import matplotlib.pyplot as plt
|
18 |
+
from PIL import Image
|
19 |
+
|
20 |
+
# Add parent directory to path
|
21 |
+
parent_dir = os.path.dirname(os.path.abspath(__file__))
|
22 |
+
sys.path.append(parent_dir)
|
23 |
+
|
24 |
+
# Import our modules
|
25 |
+
from models.multimodal_fusion import MultimodalFusion
|
26 |
+
from utils.preprocessing import enhance_xray_image, normalize_report_text
|
27 |
+
from utils.visualization import (
|
28 |
+
plot_image_prediction,
|
29 |
+
plot_multimodal_results,
|
30 |
+
plot_report_entities,
|
31 |
+
)
|
32 |
+
|
33 |
+
# Set up logging
|
34 |
+
logging.basicConfig(
|
35 |
+
level=logging.INFO,
|
36 |
+
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
|
37 |
+
handlers=[logging.StreamHandler(), logging.FileHandler("mediSync.log")],
|
38 |
+
)
|
39 |
+
logger = logging.getLogger(__name__)
|
40 |
+
|
41 |
+
# Create temporary directory for sample data if it doesn't exist
|
42 |
+
os.makedirs(os.path.join(parent_dir, "data", "sample"), exist_ok=True)
|
43 |
+
|
44 |
|
45 |
# Import configuration for end consultation logic
|
46 |
try:
|