Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -47,6 +47,7 @@ def parse_notebook(score_options, output_options, index):
|
|
47 |
sample = ds_out[score_options][index]
|
48 |
|
49 |
notebook_string = sample["text"]
|
|
|
50 |
notebook_id = sample["id"].split("/")[-1]
|
51 |
|
52 |
out_path = os.path.join(TMP_DIR, notebook_id)
|
@@ -59,16 +60,18 @@ def parse_notebook(score_options, output_options, index):
|
|
59 |
(notebook_body, resources) = html_exporter.from_notebook_node(notebook_parsed)
|
60 |
notebook_body = embed_figures(notebook_body, resources)
|
61 |
|
62 |
-
return notebook_body, out_path
|
63 |
|
64 |
|
65 |
with gr.Blocks() as demo:
|
66 |
gr.Markdown("# Kaggle Notebooks")
|
67 |
-
|
68 |
-
|
69 |
-
|
|
|
70 |
|
71 |
file = gr.File()
|
|
|
72 |
html = gr.HTML("")
|
73 |
|
74 |
|
@@ -83,7 +86,7 @@ with gr.Blocks() as demo:
|
|
83 |
outputs=[index_slider, index_slider]
|
84 |
)
|
85 |
|
86 |
-
index_slider.change(fn=parse_notebook, inputs=[score_options, output_options, index_slider], outputs=[html, file])
|
87 |
-
demo.load(fn=parse_notebook, inputs=[score_options, output_options, index_slider], outputs=[html, file])
|
88 |
|
89 |
demo.launch()
|
|
|
47 |
sample = ds_out[score_options][index]
|
48 |
|
49 |
notebook_string = sample["text"]
|
50 |
+
notebook_response = sample["response"]
|
51 |
notebook_id = sample["id"].split("/")[-1]
|
52 |
|
53 |
out_path = os.path.join(TMP_DIR, notebook_id)
|
|
|
60 |
(notebook_body, resources) = html_exporter.from_notebook_node(notebook_parsed)
|
61 |
notebook_body = embed_figures(notebook_body, resources)
|
62 |
|
63 |
+
return notebook_body, out_path, notebook_response
|
64 |
|
65 |
|
66 |
with gr.Blocks() as demo:
|
67 |
gr.Markdown("# Kaggle Notebooks")
|
68 |
+
with gr.Row():
|
69 |
+
score_options = gr.Dropdown(["error","0", "1", "2", "3", "4", "5"], value="5", label="Notebook score", info="Select the assigned notebook score.")
|
70 |
+
output_options = gr.Radio(["Outputs only", "All"], value="Outputs only", label="Output filter", info="Many notebooks contain no outputs.")
|
71 |
+
index_slider = gr.Slider(minimum=0, maximum=len(ds_out["5"]), step=1, value=0, label="Index")
|
72 |
|
73 |
file = gr.File()
|
74 |
+
response = gr.Markdown("", label="LLM score justification")
|
75 |
html = gr.HTML("")
|
76 |
|
77 |
|
|
|
86 |
outputs=[index_slider, index_slider]
|
87 |
)
|
88 |
|
89 |
+
index_slider.change(fn=parse_notebook, inputs=[score_options, output_options, index_slider], outputs=[html, file, response])
|
90 |
+
demo.load(fn=parse_notebook, inputs=[score_options, output_options, index_slider], outputs=[html, file, response])
|
91 |
|
92 |
demo.launch()
|