dgarrett-synaptics commited on
Commit
5c41e64
·
verified ·
1 Parent(s): 134c39c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -4
app.py CHANGED
@@ -65,7 +65,9 @@ def compile_model(model_name, sram_size, tensor_size, optimize, model_loc, clock
65
  # batch = 16
66
  # print(f'ERROR converting {epochs_text}, and {batch_text}')
67
  return output_text
68
-
 
 
69
 
70
  def update_sliders(sram_slider_value, tensor_slider_value):
71
 
@@ -86,14 +88,19 @@ with gr.Blocks() as demo:
86
  optimize = gr.Radio(choices=["Performance", "Size"], value='Performance', label='Performance model')
87
  model_loc = gr.Radio(choices=["sram", "flash"], value="sram", label='Model weights target')
88
 
89
-
90
  # Setup model compile
91
- model_text = gr.Textbox(label='TFLite model', value='hello_world.tflite')
 
 
 
 
 
 
92
  compile_btn = gr.Button("Compile Model")
93
  compile_text = gr.Markdown("Waiting for model results")
94
 
95
  # Compute options
96
- compile_btn.click(compile_model, inputs=[model_text, sram_slider, tensor_slider, optimize, model_loc, clock_slider], outputs=[compile_text])
97
  sram_slider.change(fn=update_sliders, inputs=[sram_slider, tensor_slider], outputs=tensor_slider)
98
  demo.load(get_oauth_info, inputs=None, outputs=user_text)
99
 
 
65
  # batch = 16
66
  # print(f'ERROR converting {epochs_text}, and {batch_text}')
67
  return output_text
68
+
69
+
70
+ model_choices = glob.glob('models/*.tflite')
71
 
72
  def update_sliders(sram_slider_value, tensor_slider_value):
73
 
 
88
  optimize = gr.Radio(choices=["Performance", "Size"], value='Performance', label='Performance model')
89
  model_loc = gr.Radio(choices=["sram", "flash"], value="sram", label='Model weights target')
90
 
 
91
  # Setup model compile
92
+ model_dropdown = gr.Dropdown(
93
+ label="Select an model",
94
+ value='models/hello_world.tflite',
95
+ choices=model_choices
96
+ )
97
+
98
+ # Run the compile
99
  compile_btn = gr.Button("Compile Model")
100
  compile_text = gr.Markdown("Waiting for model results")
101
 
102
  # Compute options
103
+ compile_btn.click(compile_model, inputs=[model_dropdown, sram_slider, tensor_slider, optimize, model_loc, clock_slider], outputs=[compile_text])
104
  sram_slider.change(fn=update_sliders, inputs=[sram_slider, tensor_slider], outputs=tensor_slider)
105
  demo.load(get_oauth_info, inputs=None, outputs=user_text)
106