Spaces:
Paused
Paused
Download src/makeIPythonSafe.py from ProjectFrozone/Site: direct link, hf CLI and curl.
- Browser
- Download file 595 Bytes
-
https://huggingface.co/spaces/ProjectFrozone/Site/resolve/96fa7c02bbdd6dc9da06f2012db40df561f09aef/src/makeIPythonSafe.py
- Command line
-
hf download hf://spaces/ProjectFrozone/Site@96fa7c02bbdd6dc9da06f2012db40df561f09aef/src/makeIPythonSafe.py
-
curl -L -o makeIPythonSafe.py https://huggingface.co/spaces/ProjectFrozone/Site/resolve/96fa7c02bbdd6dc9da06f2012db40df561f09aef/src/makeIPythonSafe.py
595 Bytes
| # If you're using IPython, this makes it so your tuning jobs don't break | |
| # wanting a non-text console output (or something...) | |
| # If you're not, this should be safe to use. | |
| def patch_ipython_display(): | |
| """Patch IPython.core.display.display if IPython is installed.""" | |
| try: | |
| import IPython.display as _ipd | |
| import IPython.core.display as _ipcd | |
| except ImportError: | |
| # IPython isn't installed; nothing to do. | |
| return | |
| if not hasattr(_ipcd, "display"): | |
| _ipcd.display = _ipd.display | |
| # Run the patch automatically on import | |
| patch_ipython_display() | |