Spaces:
Build error
Build error
NataCalc commited on
Commit ·
28bb7e7
1
Parent(s): c31913e
Update app.py
Browse files33 unmodified lines3435363738394041424344454647484950515253545556575859606162636433 unmodified lines#Launch the interfaceintf.launch(inline=False)import nbformatfrom nbconvert import PythonExporter# Load the notebooknotebook_filename = 'dogs_v_cats.ipynb' #Loading the Notebook: The code reads the specified Jupyter Notebook using nbformat.with open(notebook_filename, 'r') as f:notebook = nbformat.read(f, as_version=4)# Prepare to capture the exported codeexported_code = []# Loop through each cell in the notebookfor cell in notebook.cells:# Check if the cell is a code cell and contains '# Export'if cell.cell_type == 'code' and '#/export' in cell.source:exported_code.append(cell.source)# Join the exported code into a single stringexported_code_string = "\n\n".join(exported_code)# Save the extracted code to a .py filepython_filename = 'app.py' # Change to your desired output filenamewith open(python_filename, 'w') as f:f.write(exported_code_string)print(f'Exported code to {python_filename}')33 unmodified lines34353633 unmodified lines#Launch the interfaceintf.launch(inline=False)
app.py-28