Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Just highlight
Browse files- src/app.py +14 -10
src/app.py
CHANGED
|
@@ -16,24 +16,27 @@ def change(inp, components=[]):
|
|
| 16 |
"""
|
| 17 |
code, explanation, docs = get_text(inp)
|
| 18 |
if inp == "Basic":
|
| 19 |
-
return (
|
|
|
|
| 20 |
elif inp == "Calculating Metrics":
|
| 21 |
-
return (
|
|
|
|
| 22 |
else:
|
| 23 |
-
return (
|
|
|
|
| 24 |
|
| 25 |
initial_md = gr.Markdown("## Initial Code")
|
| 26 |
initial_code = gr.Markdown(templates["initial"])
|
| 27 |
|
| 28 |
-
with gr.Blocks() as demo:
|
| 29 |
inp = gr.Radio(
|
| 30 |
["Basic", "Calculating Metrics", "Checkpointing", "Experiment Tracking", "Gradient Accumulation"],
|
| 31 |
label="Select a feature you would like to integrate"
|
| 32 |
)
|
| 33 |
-
with gr.Row():
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
with gr.Row():
|
| 38 |
with gr.Column():
|
| 39 |
feature = gr.Markdown("## Accelerate Code")
|
|
@@ -48,7 +51,8 @@ with gr.Blocks() as demo:
|
|
| 48 |
docs = gr.Markdown()
|
| 49 |
inp.change(
|
| 50 |
fn=change,
|
| 51 |
-
inputs=inp,
|
| 52 |
-
outputs=[
|
|
|
|
| 53 |
)
|
| 54 |
demo.launch()
|
|
|
|
| 16 |
"""
|
| 17 |
code, explanation, docs = get_text(inp)
|
| 18 |
if inp == "Basic":
|
| 19 |
+
return (highlight(code), "## Accelerate Code (Base Integration)", explanation, docs)
|
| 20 |
+
# return (templates["initial"], highlight(code), "## Accelerate Code (Base Integration)", explanation, docs)
|
| 21 |
elif inp == "Calculating Metrics":
|
| 22 |
+
return (highlight(code), f"## Accelerate Code ({inp})", explanation, docs)
|
| 23 |
+
# return (templates["initial_with_metrics"], highlight(code), f"## Accelerate Code ({inp})", explanation, docs)
|
| 24 |
else:
|
| 25 |
+
return (highlight(code), f"## Accelerate Code ({inp})", explanation, docs)
|
| 26 |
+
# return (templates["accelerate"], highlight(code), f"## Accelerate Code ({inp})", explanation, docs)
|
| 27 |
|
| 28 |
initial_md = gr.Markdown("## Initial Code")
|
| 29 |
initial_code = gr.Markdown(templates["initial"])
|
| 30 |
|
| 31 |
+
with gr.Blocks(css=".gradio-container {padding: 5px}") as demo:
|
| 32 |
inp = gr.Radio(
|
| 33 |
["Basic", "Calculating Metrics", "Checkpointing", "Experiment Tracking", "Gradient Accumulation"],
|
| 34 |
label="Select a feature you would like to integrate"
|
| 35 |
)
|
| 36 |
+
# with gr.Row():
|
| 37 |
+
# with gr.Column():
|
| 38 |
+
# initial_md.render()
|
| 39 |
+
# initial_code.render()
|
| 40 |
with gr.Row():
|
| 41 |
with gr.Column():
|
| 42 |
feature = gr.Markdown("## Accelerate Code")
|
|
|
|
| 51 |
docs = gr.Markdown()
|
| 52 |
inp.change(
|
| 53 |
fn=change,
|
| 54 |
+
inputs=inp,
|
| 55 |
+
outputs=[out, feature, explanation, docs]
|
| 56 |
+
# outputs=[initial_code, out, feature, explanation, docs]
|
| 57 |
)
|
| 58 |
demo.launch()
|