Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jupyter IFrame support #159

Closed
radiantone opened this issue Oct 8, 2018 · 10 comments
Closed

Jupyter IFrame support #159

radiantone opened this issue Oct 8, 2018 · 10 comments

Comments

@radiantone
Copy link

Hi,
I have a keras model (tensorflow backend). Can I use this to visualize it in jupyter?

@lutzroeder
Copy link
Owner

See #96. Feedback is welcome.

@radiantone
Copy link
Author

I dont think that #96 ticket provides all the details needed in this ticket.

How to export the keras model to browse?
What is the server port of the netron server?
I'm not running it locally.

Just need a few concrete details here. Thanks

@lutzroeder
Copy link
Owner

lutzroeder commented Oct 8, 2018

keras_model.save('test.h5')
!pip install netron
import netron
netron.start('test.h5', 8081)

lutzroeder added a commit that referenced this issue Oct 9, 2018
@radiantone
Copy link
Author

Thanks!

@sjain-stanford
Copy link

sjain-stanford commented May 23, 2021

@lutzroeder has there been a change in API on latest release? I get this when I specify port here:

netron.start(model_path, port=8080)

TypeError: start() got an unexpected keyword argument 'port'

UPDATE: Never mind, just checked the source and address seems to be the argument to use instead of port.

@alexanderganderson
Copy link

alexanderganderson commented Jul 29, 2022

It is possible to view netron in a jupyter notebook via an IFrame html element.

import IPython

import netron
port = 6006
model_path = # <Your favorite model>
netron.start(model_path, 6006, browse=False)

IPython.display.IFrame(f"http://localhost:{port}", width=1000, height=1000)

I'm running everything locally, so I'm not sure if you need to enable another port in your case.

@lutzroeder lutzroeder changed the title How to Use this Inside Jupyter notebook Jupyter IFrame support Jul 29, 2022
@lutzroeder lutzroeder reopened this Jul 29, 2022
@lutzroeder
Copy link
Owner

@alexanderganderson can you investigate and submit a pull request.

@lovettchris
Copy link

netron.start('model.onnx', 8081) works great the first time, and auto-opens my web browser, which is fine, but the second time I do this in Jupyter, it spends a very long time saying Stopping http://localhost:8081/. Can it "share" the server so if it's started once then it just serves up the next page instantly?

(I'm on Windows 11 doing this in VS Code version of Jupyter).

PS: I'd rather have the diagram show up inline inside the notebook. IPython.display.IFrame works, but is not pretty because browser is also launched and I still have the netron.start problem above.

@avilum
Copy link

avilum commented May 11, 2023

@lutzroeder
Copy link
Owner

Duplicate of #1324

@lutzroeder lutzroeder marked this as a duplicate of #1324 Aug 15, 2024
@lutzroeder lutzroeder closed this as not planned Won't fix, can't repro, duplicate, stale Aug 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants