BhumikaMak commited on
Commit
e015d4c
·
verified ·
1 Parent(s): bccb3e3

local model upload

Browse files
Files changed (1) hide show
  1. app.py +10 -7
app.py CHANGED
@@ -158,22 +158,25 @@ with gr.Blocks(css=custom_css) as interface:
158
  if __name__ == "__main__":
159
  interface.launch(share=True)
160
  """
161
-
162
  import gradio as gr
163
  import netron
164
 
165
  # Function to visualize the model using Netron
166
  def visualize_model(model_path):
167
- netron.start(model_path)
 
 
 
 
168
 
169
  # Create Gradio interface
170
  iface = gr.Interface(
171
- fn=visualize_model,
172
- inputs="text",
173
- outputs="text",
174
  title="Model Visualization with Netron",
175
- description="Enter the path to your model file (e.g., .onnx, .h5) to visualize."
176
  )
177
 
178
  # Launch the app
179
- iface.launch(share=True)
 
158
  if __name__ == "__main__":
159
  interface.launch(share=True)
160
  """
 
161
  import gradio as gr
162
  import netron
163
 
164
  # Function to visualize the model using Netron
165
  def visualize_model(model_path):
166
+ # Start Netron to visualize the model
167
+ netron.start(model_path, browse=False) # Set browse=False to avoid opening a new browser tab
168
+
169
+ # Specify the local path to your model file
170
+ model_path = os.path.join(os.getcwd(), "weight_files/yolov5.onnx") # Change this to your actual model file path
171
 
172
  # Create Gradio interface
173
  iface = gr.Interface(
174
+ fn=lambda: visualize_model(model_path), # Call the function without user input
175
+ inputs=None, # No input required from user
176
+ outputs="text", # Output type is text (or you can use "html" if needed)
177
  title="Model Visualization with Netron",
178
+ description="This app visualizes a model using Netron."
179
  )
180
 
181
  # Launch the app
182
+ iface.launch()