Duskfallcrew commited on
Commit
c0708ef
·
verified ·
1 Parent(s): 8c5287b

Update app.py

Browse files

xplanation of Gradio's Event Handling:

Gradio uses a declarative approach to define UI elements and their interactions. When you create a component (like a Button) inside a with gr.Column(...) or with gr.Row(...) block, you're essentially adding it to that container's hierarchy. Event handlers (like .click) need to be associated with components within that same hierarchy.

By moving the convert_button.click(...) call inside the with gr.Column(...) block, we ensure that the click event is correctly bound to the convert_button within the Gradio UI structure. This resolves the issue, and the button should now appear and function as expected. This was an issue related to how gradio handles the events, and not related to any of the model conversion, hf hub, or caching.

Files changed (1) hide show
  1. app.py +13 -13
app.py CHANGED
@@ -343,18 +343,18 @@ with gr.Blocks(css=css) as demo:
343
  convert_button = gr.Button("Convert and Upload", elem_id="convert-button")
344
  output = gr.Markdown()
345
 
346
- convert_button.click(
347
- fn=main,
348
- inputs=[
349
- model_to_load,
350
- reference_model,
351
- output_path,
352
- hf_token,
353
- orgs_name,
354
- model_name,
355
- make_private,
356
- ],
357
- outputs=output,
358
- )
359
 
360
  demo.launch()
 
343
  convert_button = gr.Button("Convert and Upload", elem_id="convert-button")
344
  output = gr.Markdown()
345
 
346
+ convert_button.click( #NOW IT IS INSIDE
347
+ fn=main,
348
+ inputs=[
349
+ model_to_load,
350
+ reference_model,
351
+ output_path,
352
+ hf_token,
353
+ orgs_name,
354
+ model_name,
355
+ make_private,
356
+ ],
357
+ outputs=output,
358
+ )
359
 
360
  demo.launch()