Spaces:
Sleeping
Sleeping
update: added netron , display changes
Browse files
app.py
CHANGED
@@ -1,57 +1,48 @@
|
|
1 |
import gradio as gr
|
2 |
import os
|
|
|
3 |
|
|
|
4 |
yolov5_result = os.path.join(os.getcwd(), "data/xai/yolov5.png")
|
5 |
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 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
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: black;
|
36 |
-
background-size: 1800px 1800px;
|
37 |
-
height: 100%;
|
38 |
-
margin: 0;
|
39 |
-
overflow-y: auto;
|
40 |
}
|
41 |
#neural-vista-title {
|
42 |
-
color: #800000 !important;
|
43 |
-
font-size: 32px;
|
44 |
font-weight: bold;
|
45 |
text-align: center;
|
46 |
}
|
47 |
#neural-vista-text {
|
48 |
-
color: white !important;
|
49 |
-
font-size: 18px;
|
50 |
font-weight: bold;
|
51 |
text-align: center;
|
52 |
-
|
53 |
}
|
54 |
-
|
55 |
#highlighted-text {
|
56 |
font-weight: bold;
|
57 |
color: #1976d2;
|
@@ -62,17 +53,21 @@ with gr.Blocks(css=custom_css) as demo:
|
|
62 |
gr.HTML("""
|
63 |
<div style="border: 2px solid #a05252; padding: 20px; border-radius: 8px;">
|
64 |
<span style="color: #E6E6FA; font-family: 'Papyrus', cursive; font-weight: bold; font-size: 32px;">NeuralVista</span><br><br>
|
65 |
-
<span style="color: #E6E6FA; font-family: 'Papyrus', cursive; font-size: 18px;">A harmonious framework of tools
|
66 |
</div>
|
67 |
""")
|
|
|
68 |
with gr.Row():
|
69 |
with gr.Column():
|
70 |
gr.Markdown("Yolov5")
|
71 |
gr.Image(yolov5_result, label="Detections & Interpretability Map")
|
72 |
gr.Image(yolov5_dff, label="Feature Factorization & discovered concept")
|
|
|
|
|
73 |
with gr.Column():
|
74 |
gr.Markdown("Yolov8")
|
75 |
gr.Image(yolov8_result, label="Detections & Interpretability Map")
|
76 |
gr.Image(yolov8_dff, label="Feature Factorization & discovered concept")
|
|
|
77 |
|
78 |
-
demo.launch()
|
|
|
1 |
import gradio as gr
|
2 |
import os
|
3 |
+
import threading
|
4 |
|
5 |
+
# Paths for images
|
6 |
yolov5_result = os.path.join(os.getcwd(), "data/xai/yolov5.png")
|
7 |
yolov8_result = os.path.join(os.getcwd(), "data/xai/yolov8.png")
|
8 |
yolov5_dff = os.path.join(os.getcwd(), "data/xai/yolov5_dff.png")
|
9 |
yolov8_dff = os.path.join(os.getcwd(), "data/xai/yolov8_dff.png")
|
10 |
|
11 |
+
# Netron HTML templates
|
12 |
+
def get_netron_html(model_url):
|
13 |
+
return f"""
|
14 |
+
<iframe
|
15 |
+
src="{model_url}"
|
16 |
+
width="100%"
|
17 |
+
height="800"
|
18 |
+
frameborder="0">
|
19 |
+
</iframe>
|
20 |
+
"""
|
21 |
+
|
22 |
+
# URLs for Netron visualizations
|
23 |
+
yolov5_url = "https://netron.app/?url=https://huggingface.co/FFusion/FFusionXL-BASE/blob/main/vae_encoder/model.onnx"
|
24 |
+
yolov8_url = "https://netron.app/?url=https://huggingface.co/spaces/BhumikaMak/NeuralVista/resolve/main/weight_files/yolov8s.pt"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
custom_css = """
|
27 |
body {
|
28 |
+
background-color: black;
|
29 |
+
background-size: 1800px 1800px;
|
30 |
+
height: 100%;
|
31 |
+
margin: 0;
|
32 |
+
overflow-y: auto;
|
33 |
}
|
34 |
#neural-vista-title {
|
35 |
+
color: #800000 !important;
|
36 |
+
font-size: 32px;
|
37 |
font-weight: bold;
|
38 |
text-align: center;
|
39 |
}
|
40 |
#neural-vista-text {
|
41 |
+
color: white !important;
|
42 |
+
font-size: 18px;
|
43 |
font-weight: bold;
|
44 |
text-align: center;
|
|
|
45 |
}
|
|
|
46 |
#highlighted-text {
|
47 |
font-weight: bold;
|
48 |
color: #1976d2;
|
|
|
53 |
gr.HTML("""
|
54 |
<div style="border: 2px solid #a05252; padding: 20px; border-radius: 8px;">
|
55 |
<span style="color: #E6E6FA; font-family: 'Papyrus', cursive; font-weight: bold; font-size: 32px;">NeuralVista</span><br><br>
|
56 |
+
<span style="color: #E6E6FA; font-family: 'Papyrus', cursive; font-size: 18px;">A harmonious framework of tools <span style="color: yellow; font-family: 'Papyrus', cursive; font-size: 18px;">☼</span> designed to illuminate the inner workings of AI.</span>
|
57 |
</div>
|
58 |
""")
|
59 |
+
|
60 |
with gr.Row():
|
61 |
with gr.Column():
|
62 |
gr.Markdown("Yolov5")
|
63 |
gr.Image(yolov5_result, label="Detections & Interpretability Map")
|
64 |
gr.Image(yolov5_dff, label="Feature Factorization & discovered concept")
|
65 |
+
gr.HTML(get_netron_html(yolov5_url))
|
66 |
+
|
67 |
with gr.Column():
|
68 |
gr.Markdown("Yolov8")
|
69 |
gr.Image(yolov8_result, label="Detections & Interpretability Map")
|
70 |
gr.Image(yolov8_dff, label="Feature Factorization & discovered concept")
|
71 |
+
gr.HTML(get_netron_html(yolov8_url))
|
72 |
|
73 |
+
demo.launch()
|