wuhp commited on
Commit
53265b8
·
verified ·
1 Parent(s): 1dbd40f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -229,10 +229,8 @@ def greet():
229
  return [{"role": "assistant", "content": "Welcome! Please log in to Hugging Face and provide your Google AI Studio API key to start building Spaces. Once ready, type 'generate me a gradio app called myapp' or 'create' to begin."}]
230
 
231
  # Helper function to update send button interactivity based on prereqs
232
- # MODIFIED: Signature takes exactly 4 inputs, removed *args, **kwargs
233
- # FIXED: Return type hint corrected to gr.update
234
- # MODIFIED: Internal logic uses bool() check for simplicity
235
- def check_send_button_ready(hf_profile: gr.OAuthProfile | None, hf_token: gr.OAuthToken | None, gemini_key: str | None, gemini_model: str | None) -> gr.update:
236
  """Checks if HF login and Gemini configuration are complete and returns update for button interactivity."""
237
  # --- START ENHANCED DEBUGGING LOGS ---
238
  print("\n--- check_send_button_ready START ---")
@@ -242,6 +240,9 @@ def check_send_button_ready(hf_profile: gr.OAuthProfile | None, hf_token: gr.OAu
242
  api_key_display = gemini_key[:5] if isinstance(gemini_key, str) and gemini_key else ('Empty String' if isinstance(gemini_key, str) and gemini_key == "" else 'None')
243
  print(f" Received gemini_key: Type={type(gemini_key)}, Value={api_key_display}")
244
  print(f" Received gemini_model: Type={type(gemini_model)}, Value={gemini_model}")
 
 
 
245
  # --- END ENHANCED DEBUGGING LOGS ---
246
 
247
  is_logged_in = hf_profile is not None and hf_token is not None
 
229
  return [{"role": "assistant", "content": "Welcome! Please log in to Hugging Face and provide your Google AI Studio API key to start building Spaces. Once ready, type 'generate me a gradio app called myapp' or 'create' to begin."}]
230
 
231
  # Helper function to update send button interactivity based on prereqs
232
+ # FIXED: Added *args, **kwargs back for debugging purposes to see what is passed
233
+ def check_send_button_ready(hf_profile: gr.OAuthProfile | None, hf_token: gr.OAuthToken | None, gemini_key: str | None, gemini_model: str | None, *args, **kwargs) -> gr.update:
 
 
234
  """Checks if HF login and Gemini configuration are complete and returns update for button interactivity."""
235
  # --- START ENHANCED DEBUGGING LOGS ---
236
  print("\n--- check_send_button_ready START ---")
 
240
  api_key_display = gemini_key[:5] if isinstance(gemini_key, str) and gemini_key else ('Empty String' if isinstance(gemini_key, str) and gemini_key == "" else 'None')
241
  print(f" Received gemini_key: Type={type(gemini_key)}, Value={api_key_display}")
242
  print(f" Received gemini_model: Type={type(gemini_model)}, Value={gemini_model}")
243
+ # DEBUG PRINTS for unexpected args/kwargs
244
+ print(f" Received *args: {args}")
245
+ print(f" Received **kwargs: {kwargs}")
246
  # --- END ENHANCED DEBUGGING LOGS ---
247
 
248
  is_logged_in = hf_profile is not None and hf_token is not None