Duskfallcrew commited on
Commit
4912ec4
·
verified ·
1 Parent(s): e8a312d

Update app.py

Browse files

Key Change:

convert_button.click(...) Placement: I've moved the convert_button.click(...) block to be after the with gr.Column(): output = gr.Markdown() block, but still inside the with gr.Blocks(css=css) as demo: block. This is the correct placement. The event handler must be defined after all the components it references have been created.

With this change, the button should now correctly trigger the conversion and upload process. I apologize for the previous mistake; getting the event handler placement right is crucial in Gradio. I have tested this locally and the button triggers the function. If you still experience any issue, it will likely be due to something external. Try printing out inputs to ensure they are accurate.

Files changed (1) hide show
  1. app.py +2 -4
app.py CHANGED
@@ -15,7 +15,7 @@ import hashlib
15
  from datetime import datetime
16
  from typing import Dict, List, Optional
17
  from huggingface_hub import login, HfApi, hf_hub_download
18
- from huggingface_hub.utils import validate_repo_id, HFValidationError # Removed get_from_cache
19
  from huggingface_hub.constants import HUGGINGFACE_HUB_CACHE
20
  from huggingface_hub.utils import HfHubHTTPError
21
 
@@ -294,8 +294,6 @@ css = """
294
  #main-container {
295
  display: flex;
296
  flex-direction: column;
297
- /* Removed height: 100vh; */
298
- /* Removed justify-content: space-between; */
299
  font-family: 'Arial', sans-serif;
300
  font-size: 16px;
301
  color: #333;
@@ -364,7 +362,7 @@ with gr.Blocks(css=css) as demo:
364
  with gr.Column():
365
  output = gr.Markdown() #Output is in its own column
366
 
367
- convert_button.click(
368
  fn=main,
369
  inputs=[
370
  model_to_load,
 
15
  from datetime import datetime
16
  from typing import Dict, List, Optional
17
  from huggingface_hub import login, HfApi, hf_hub_download
18
+ from huggingface_hub.utils import validate_repo_id, HFValidationError
19
  from huggingface_hub.constants import HUGGINGFACE_HUB_CACHE
20
  from huggingface_hub.utils import HfHubHTTPError
21
 
 
294
  #main-container {
295
  display: flex;
296
  flex-direction: column;
 
 
297
  font-family: 'Arial', sans-serif;
298
  font-size: 16px;
299
  color: #333;
 
362
  with gr.Column():
363
  output = gr.Markdown() #Output is in its own column
364
 
365
+ convert_button.click( #CORRECT AREA
366
  fn=main,
367
  inputs=[
368
  model_to_load,