BhumikaMak commited on
Commit
2cfd9ce
·
verified ·
1 Parent(s): 0b08201
Files changed (1) hide show
  1. app.py +28 -7
app.py CHANGED
@@ -9,7 +9,7 @@ import numpy as np
9
  from yolov5 import xai_yolov5
10
  from yolov8 import xai_yolov8s
11
  import requests
12
-
13
  # Sample images directory
14
  sample_images = {
15
  "Sample 1": os.path.join(os.getcwd(), "data/xai/sample1.jpeg"),
@@ -86,12 +86,12 @@ def view_netron_model():
86
  # Custom CSS for styling (optional)
87
  custom_css = """
88
  #run_button {
89
- background-color: purple;
90
- color: white;
91
- width: 120px;
92
- border-radius: 5px;
93
- font-size: 14px;
94
- }
95
  """
96
 
97
  # Gradio UI
@@ -157,3 +157,24 @@ with gr.Blocks(css=custom_css) as interface:
157
  # Launch Gradio app
158
  if __name__ == "__main__":
159
  interface.launch(share=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  from yolov5 import xai_yolov5
10
  from yolov8 import xai_yolov8s
11
  import requests
12
+ """
13
  # Sample images directory
14
  sample_images = {
15
  "Sample 1": os.path.join(os.getcwd(), "data/xai/sample1.jpeg"),
 
86
  # Custom CSS for styling (optional)
87
  custom_css = """
88
  #run_button {
89
+ # background-color: purple;
90
+ # color: white;
91
+ # width: 120px;
92
+ # border-radius: 5px;
93
+ # font-size: 14px;
94
+ #}
95
  """
96
 
97
  # Gradio UI
 
157
  # Launch Gradio app
158
  if __name__ == "__main__":
159
  interface.launch(share=True)
160
+ """
161
+
162
+ import gradio as gr
163
+ import netron
164
+
165
+ # Define a function to visualize the model
166
+ def visualize_model(model_file):
167
+ # Launch the Netron viewer in a web browser
168
+ netron.start(model_file)
169
+ return "Model visualization launched in browser."
170
+
171
+ # Create a Gradio interface
172
+ interface = gr.Interface(
173
+ fn=visualize_model,
174
+ inputs=gr.File(label="Upload Model File"), # Model file input
175
+ outputs="text", # Just a text output to indicate launch
176
+ live=True
177
+ )
178
+
179
+ interface.launch()
180
+