Spaces:
Sleeping
Sleeping
update: added header, netron function
Browse files
app.py
CHANGED
@@ -6,8 +6,67 @@ yolov8_result = os.path.join(os.getcwd(), "data/xai/yolov8.png")
|
|
6 |
yolov5_dff = os.path.join(os.getcwd(), "data/xai/yolov5_dff.png")
|
7 |
yolov8_dff = os.path.join(os.getcwd(), "data/xai/yolov8_dff.png")
|
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
with gr.Row():
|
12 |
with gr.Column():
|
13 |
gr.Markdown("Yolov5")
|
|
|
6 |
yolov5_dff = os.path.join(os.getcwd(), "data/xai/yolov5_dff.png")
|
7 |
yolov8_dff = os.path.join(os.getcwd(), "data/xai/yolov8_dff.png")
|
8 |
|
9 |
+
def view_model(selected_models):
|
10 |
+
"""Generate Netron visualization for the selected models."""
|
11 |
+
netron_html = ""
|
12 |
+
for model in selected_models:
|
13 |
+
if model=="yolov8s":
|
14 |
+
netron_html = f"""
|
15 |
+
<iframe
|
16 |
+
src="https://netron.app/?url=https://huggingface.co/spaces/BhumikaMak/NeuralVista/resolve/main/weight_files/yolov8s.pt"
|
17 |
+
width="100%"
|
18 |
+
height="800"
|
19 |
+
frameborder="0">
|
20 |
+
</iframe>
|
21 |
+
"""
|
22 |
+
if model == "yolov5":
|
23 |
+
netron_html = f"""
|
24 |
+
<iframe
|
25 |
+
src="https://netron.app/?url=https://huggingface.co/FFusion/FFusionXL-BASE/blob/main/vae_encoder/model.onnx"
|
26 |
+
width="100%"
|
27 |
+
height="800"
|
28 |
+
frameborder="0">
|
29 |
+
</iframe>
|
30 |
+
"""
|
31 |
+
return netron_html if netron_html else "<p>No valid models selected for visualization.</p>"
|
32 |
|
33 |
+
custom_css = """
|
34 |
+
body {
|
35 |
+
background-color: #FFFAFO; /* Navy blue background */
|
36 |
+
background-image:
|
37 |
+
linear-gradient(to right, transparent 39px, #a05252 1px, transparent 40px), /* Vertical dashed lines */
|
38 |
+
background-size: 1800px 1800px; /* Grid cell size */
|
39 |
+
height: 100%; /* Ensure body height is 100% of the viewport */
|
40 |
+
margin: 0; /* Remove default margin */
|
41 |
+
overflow-y: auto; /* Allow vertical scrolling if needed */
|
42 |
+
}
|
43 |
+
#neural-vista-title {
|
44 |
+
color: #800000 !important; /* Purple color for the title */
|
45 |
+
font-size: 32px; /* Adjust font size as needed */
|
46 |
+
font-weight: bold;
|
47 |
+
text-align: center;
|
48 |
+
}
|
49 |
+
#neural-vista-text {
|
50 |
+
color: #800000 !important; /* Purple color for the title */
|
51 |
+
font-size: 18px; /* Adjust font size as needed */
|
52 |
+
font-weight: bold;
|
53 |
+
text-align: center;
|
54 |
+
|
55 |
+
}
|
56 |
+
|
57 |
+
#highlighted-text {
|
58 |
+
font-weight: bold;
|
59 |
+
color: #1976d2;
|
60 |
+
}
|
61 |
+
"""
|
62 |
+
|
63 |
+
with gr.Blocks(css=custom_css) as demo:
|
64 |
+
gr.HTML("""
|
65 |
+
<div style="border: 2px solid #a05252; padding: 20px; border-radius: 8px;">
|
66 |
+
<span style="color: #800000; font-family: 'Papyrus', cursive; font-weight: bold; font-size: 32px;">NeuralVista</span><br><br>
|
67 |
+
<span style="color: black; font-family: 'Papyrus', cursive; font-size: 18px;">A harmonious framework of tools ☼ designed to illuminate the inner workings of AI.</span>
|
68 |
+
</div>
|
69 |
+
""")
|
70 |
with gr.Row():
|
71 |
with gr.Column():
|
72 |
gr.Markdown("Yolov5")
|