yiren98 commited on
Commit
592a5ce
·
1 Parent(s): bf3710c
Files changed (1) hide show
  1. gradio_app.py +6 -2
gradio_app.py CHANGED
@@ -111,10 +111,11 @@ def load_target_model(selected_model):
111
  lora_model.eval()
112
 
113
  logger.info("Models loaded successfully.")
 
114
 
115
  except Exception as e:
116
  logger.error(f"Error loading models: {e}")
117
- raise
118
 
119
  # Image pre-processing (resize and padding)
120
  class ResizeWithPadding:
@@ -296,6 +297,9 @@ with gr.Blocks() as demo:
296
  # Load Model Button
297
  load_button = gr.Button("Load Model")
298
 
 
 
 
299
  # Run Button
300
  run_button = gr.Button("Generate Image")
301
 
@@ -303,7 +307,7 @@ with gr.Blocks() as demo:
303
  result_image = gr.Image(label="Generated Image")
304
 
305
  # Load model button action
306
- load_button.click(fn=load_target_model, inputs=[recraft_model], outputs=[])
307
 
308
  # Run Button
309
  run_button.click(fn=infer, inputs=[prompt, sample_image, frame_num, seed], outputs=[result_image])
 
111
  lora_model.eval()
112
 
113
  logger.info("Models loaded successfully.")
114
+ return "Models loaded successfully."
115
 
116
  except Exception as e:
117
  logger.error(f"Error loading models: {e}")
118
+ return f"Error loading models: {e}"
119
 
120
  # Image pre-processing (resize and padding)
121
  class ResizeWithPadding:
 
297
  # Load Model Button
298
  load_button = gr.Button("Load Model")
299
 
300
+ # Status message box
301
+ status_box = gr.Textbox(label="Status", placeholder="Model loading status", interactive=False, value="Model not loaded")
302
+
303
  # Run Button
304
  run_button = gr.Button("Generate Image")
305
 
 
307
  result_image = gr.Image(label="Generated Image")
308
 
309
  # Load model button action
310
+ load_button.click(fn=load_target_model, inputs=[recraft_model], outputs=[status_box])
311
 
312
  # Run Button
313
  run_button.click(fn=infer, inputs=[prompt, sample_image, frame_num, seed], outputs=[result_image])