muellerzr HF staff commited on
Commit
7162f12
1 Parent(s): 1cbe8ed

Update to include default value of basic

Browse files
Files changed (1) hide show
  1. src/app.py +8 -10
src/app.py CHANGED
@@ -25,34 +25,32 @@ def change(inp):
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() 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")
43
- out = gr.Markdown()
44
  with gr.Row():
45
  with gr.Column():
46
  gr.Markdown("## Explanation")
47
- explanation = gr.Markdown()
48
  with gr.Row():
49
  with gr.Column():
50
  gr.Markdown("## Documentation Links")
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()
 
25
  return (highlight(code), f"## Accelerate Code ({inp})", explanation, docs)
26
  # return (templates["accelerate"], highlight(code), f"## Accelerate Code ({inp})", explanation, docs)
27
 
28
+ default = change("Basic")
29
+
30
  initial_md = gr.Markdown("## Initial Code")
31
  initial_code = gr.Markdown(templates["initial"])
32
 
33
  with gr.Blocks() as demo:
34
  inp = gr.Radio(
35
  ["Basic", "Calculating Metrics", "Checkpointing", "Experiment Tracking", "Gradient Accumulation"],
36
+ label="Select a feature you would like to integrate",
37
+ value="Basic"
38
  )
 
 
 
 
39
  with gr.Row():
40
  with gr.Column():
41
  feature = gr.Markdown("## Accelerate Code")
42
+ out = gr.Markdown(default[0])
43
  with gr.Row():
44
  with gr.Column():
45
  gr.Markdown("## Explanation")
46
+ explanation = gr.Markdown(default[2])
47
  with gr.Row():
48
  with gr.Column():
49
  gr.Markdown("## Documentation Links")
50
+ docs = gr.Markdown(default[3])
51
  inp.change(
52
  fn=change,
53
  inputs=inp,
54
+ outputs=[out, feature, explanation, docs]
 
55
  )
56
  demo.launch()