Khalid Rafiq commited on
Commit
3b01b0f
·
1 Parent(s): 0710b67

Add app.py as a backup entry point

Browse files
Files changed (1) hide show
  1. app.py +14 -0
app.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import nbformat
3
+ from nbconvert import PythonExporter
4
+ import subprocess
5
+
6
+ def run_notebook():
7
+ with open("app.ipynb") as f:
8
+ notebook = nbformat.read(f, as_version=4)
9
+ python_script, _ = PythonExporter().from_notebook_node(notebook)
10
+ with open("app_temp.py", "w") as f:
11
+ f.write(python_script)
12
+ subprocess.run(["python", "app_temp.py"])
13
+
14
+ run_notebook()