milwright commited on
Commit
3b399f8
·
1 Parent(s): 2d896a6

update config.json upload field

Browse files
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -333,8 +333,8 @@ class SpaceGenerator:
333
  inputs=[config_upload],
334
  outputs=[
335
  self.name_input, self.tagline_input, self.description_input, self.system_prompt_input,
336
- self.model_input, self.language_input, self.theme_input, self.temperature_input,
337
- self.max_tokens_input, upload_status
338
  ] + self.example_inputs + self.url_inputs
339
  )
340
 
@@ -798,8 +798,8 @@ class SpaceGenerator:
798
  def _apply_uploaded_config(self, config_file):
799
  """Apply uploaded configuration file"""
800
  if not config_file:
801
- # 9 basic + 1 status + 5 examples + 10 URLs = 25 total
802
- return [gr.update() for _ in range(25)]
803
 
804
  try:
805
  with open(config_file, 'r') as f:
@@ -814,8 +814,10 @@ class SpaceGenerator:
814
  gr.update(value=config.get('model', 'google/gemini-2.0-flash-001')),
815
  gr.update(value=config.get('language', 'English')),
816
  gr.update(value=config.get('theme', 'Default')),
 
817
  gr.update(value=config.get('temperature', 0.7)),
818
- gr.update(value=config.get('max_tokens', 750))
 
819
  ]
820
 
821
  # Status message
@@ -843,7 +845,7 @@ class SpaceGenerator:
843
  return updates
844
 
845
  except Exception as e:
846
- error_updates = [gr.update() for _ in range(9)] # Basic fields
847
  error_updates.append(gr.update(
848
  value=f"Error loading configuration: {str(e)}",
849
  visible=True
 
333
  inputs=[config_upload],
334
  outputs=[
335
  self.name_input, self.tagline_input, self.description_input, self.system_prompt_input,
336
+ self.model_input, self.language_input, self.theme_input, self.api_key_var_input,
337
+ self.temperature_input, self.max_tokens_input, self.access_code_input, upload_status
338
  ] + self.example_inputs + self.url_inputs
339
  )
340
 
 
798
  def _apply_uploaded_config(self, config_file):
799
  """Apply uploaded configuration file"""
800
  if not config_file:
801
+ # 11 basic + 1 status + 5 examples + 10 URLs = 27 total
802
+ return [gr.update() for _ in range(27)]
803
 
804
  try:
805
  with open(config_file, 'r') as f:
 
814
  gr.update(value=config.get('model', 'google/gemini-2.0-flash-001')),
815
  gr.update(value=config.get('language', 'English')),
816
  gr.update(value=config.get('theme', 'Default')),
817
+ gr.update(value=config.get('api_key_var', 'API_KEY')),
818
  gr.update(value=config.get('temperature', 0.7)),
819
+ gr.update(value=config.get('max_tokens', 750)),
820
+ gr.update(value=config.get('access_code', ''))
821
  ]
822
 
823
  # Status message
 
845
  return updates
846
 
847
  except Exception as e:
848
+ error_updates = [gr.update() for _ in range(11)] # Basic fields
849
  error_updates.append(gr.update(
850
  value=f"Error loading configuration: {str(e)}",
851
  visible=True