-2

I have a flask application which needs to import some functions from my machine learning model present in Jupyter Notebook. How can i import these functions in my flask app?

I tried importing it as

#myapp.py

from ipynb.fs.full. import *

But doesn't seem to work and getting the below error..

ModuleNotFoundError: No module named 'ipynb'

Rajesh s
  • 175
  • 1
  • 8
  • Possible duplicate of [How can I import from another ipython-notebook?](https://stackoverflow.com/questions/19564625/how-can-i-import-from-another-ipython-notebook) – Nathan Apr 11 '19 at 05:18
  • There are a few existing questions about importing functions from one notebook to another; some of the solutions look like they ought to work to import from a notebook regardless of whether you're importing to a script or notebook. – Nathan Apr 11 '19 at 05:19
  • Actually, it seems like the method you're trying to use is one of those, but you didn't `pip install ipynb`? You also don't seem to be giving the name of the notebook you want to import – Nathan Apr 11 '19 at 05:21

1 Answers1

0

Given you're going to use it in a flask app, you should probably just convert your .ipynb to a .py file, most easily done in the jupyter notebook interface. Click File > Download as > Python (.py), after which you can import it like a regular python file.

Frederik Bode
  • 2,632
  • 1
  • 10
  • 17