Spaces:
Running
Running
milwright
commited on
Commit
Β·
796e312
1
Parent(s):
4ce68d1
add language support to configuration and templates
Browse files- academic_templates.json +1 -0
- app.py +43 -14
- space_template.py +31 -6
academic_templates.json
CHANGED
@@ -85,6 +85,7 @@
|
|
85 |
"api_key_var": "API_KEY",
|
86 |
"temperature": 0.5,
|
87 |
"max_tokens": 250,
|
|
|
88 |
"grounding_urls": [],
|
89 |
"grounding_urls_enabled": false,
|
90 |
"enable_dynamic_urls": false
|
|
|
85 |
"api_key_var": "API_KEY",
|
86 |
"temperature": 0.5,
|
87 |
"max_tokens": 250,
|
88 |
+
"language": "Italian",
|
89 |
"grounding_urls": [],
|
90 |
"grounding_urls_enabled": false,
|
91 |
"enable_dynamic_urls": false
|
app.py
CHANGED
@@ -162,6 +162,27 @@ class SpaceGenerator:
|
|
162 |
value="google/gemini-2.0-flash-001"
|
163 |
)
|
164 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
165 |
with gr.Row():
|
166 |
self.temperature_input = gr.Slider(
|
167 |
label="Temperature",
|
@@ -312,11 +333,11 @@ class SpaceGenerator:
|
|
312 |
inputs=[
|
313 |
template_selector, self.previous_template, self.template_cache,
|
314 |
self.name_input, self.tagline_input, self.description_input, self.system_prompt_input,
|
315 |
-
self.model_input, self.temperature_input, self.max_tokens_input
|
316 |
] + self.example_inputs + self.url_inputs,
|
317 |
outputs=[
|
318 |
self.name_input, self.tagline_input, self.description_input, self.system_prompt_input,
|
319 |
-
self.model_input, self.temperature_input, self.max_tokens_input
|
320 |
] + self.example_inputs + self.url_inputs + [self.previous_template, self.template_cache]
|
321 |
)
|
322 |
|
@@ -325,7 +346,7 @@ class SpaceGenerator:
|
|
325 |
inputs=[config_upload],
|
326 |
outputs=[
|
327 |
self.name_input, self.tagline_input, self.description_input, self.system_prompt_input,
|
328 |
-
self.model_input, self.theme_input, self.temperature_input,
|
329 |
self.max_tokens_input, upload_status
|
330 |
] + self.example_inputs + self.url_inputs
|
331 |
)
|
@@ -397,7 +418,7 @@ class SpaceGenerator:
|
|
397 |
self._preview_configuration,
|
398 |
inputs=[
|
399 |
self.name_input, self.tagline_input, self.description_input, self.system_prompt_input,
|
400 |
-
self.model_input, self.theme_input, self.api_key_var_input,
|
401 |
self.temperature_input, self.max_tokens_input, self.access_code_input
|
402 |
] + self.example_inputs + self.url_inputs,
|
403 |
outputs=[self.config_state]
|
@@ -410,7 +431,7 @@ class SpaceGenerator:
|
|
410 |
self._generate_package,
|
411 |
inputs=[
|
412 |
self.name_input, self.tagline_input, self.description_input, self.system_prompt_input,
|
413 |
-
self.model_input, self.theme_input, self.api_key_var_input,
|
414 |
self.temperature_input, self.max_tokens_input, self.access_code_input
|
415 |
] + self.example_inputs + self.url_inputs,
|
416 |
outputs=[
|
@@ -608,7 +629,7 @@ class SpaceGenerator:
|
|
608 |
create_support_docs()
|
609 |
|
610 |
def _apply_template(self, template_name, prev_template, cache,
|
611 |
-
name, tagline, desc, prompt, model, temp, tokens, *args):
|
612 |
"""Apply selected template to form fields with caching"""
|
613 |
# Split args into examples and URLs
|
614 |
example_values = args[:5] # First 5 are examples
|
@@ -625,6 +646,7 @@ class SpaceGenerator:
|
|
625 |
'description': desc,
|
626 |
'system_prompt': prompt,
|
627 |
'model': model,
|
|
|
628 |
'temperature': temp,
|
629 |
'max_tokens': tokens,
|
630 |
'examples': examples_list,
|
@@ -661,6 +683,7 @@ class SpaceGenerator:
|
|
661 |
gr.update(value=custom.get('description', '')),
|
662 |
gr.update(value=custom.get('system_prompt', '')),
|
663 |
gr.update(value=custom.get('model', 'google/gemini-2.0-flash-001')),
|
|
|
664 |
gr.update(value=custom.get('temperature', 0.7)),
|
665 |
gr.update(value=custom.get('max_tokens', 750))
|
666 |
] + example_updates + url_updates + [template_name, cache]
|
@@ -682,6 +705,7 @@ class SpaceGenerator:
|
|
682 |
gr.update(value='A versatile AI assistant powered by advanced language models.'),
|
683 |
gr.update(value='You are a helpful AI assistant.'),
|
684 |
gr.update(value='google/gemini-2.0-flash-001'),
|
|
|
685 |
gr.update(value=0.7),
|
686 |
gr.update(value=750)
|
687 |
] + example_updates + url_updates + [template_name, cache]
|
@@ -713,19 +737,20 @@ class SpaceGenerator:
|
|
713 |
gr.update(value=template.get('description', '')),
|
714 |
gr.update(value=template.get('system_prompt', '')),
|
715 |
gr.update(value=template.get('model', 'google/gemini-2.0-flash-001')),
|
|
|
716 |
gr.update(value=template.get('temperature', 0.7)),
|
717 |
gr.update(value=template.get('max_tokens', 750))
|
718 |
] + example_updates + url_updates + [template_name, cache]
|
719 |
else:
|
720 |
# Invalid template, no updates
|
721 |
-
#
|
722 |
-
return [gr.update() for _ in range(
|
723 |
|
724 |
def _apply_uploaded_config(self, config_file):
|
725 |
"""Apply uploaded configuration file"""
|
726 |
if not config_file:
|
727 |
-
#
|
728 |
-
return [gr.update() for _ in range(
|
729 |
|
730 |
try:
|
731 |
with open(config_file, 'r') as f:
|
@@ -738,6 +763,7 @@ class SpaceGenerator:
|
|
738 |
gr.update(value=config.get('description', '')),
|
739 |
gr.update(value=config.get('system_prompt', '')),
|
740 |
gr.update(value=config.get('model', 'google/gemini-2.0-flash-001')),
|
|
|
741 |
gr.update(value=config.get('theme', 'Default')),
|
742 |
gr.update(value=config.get('temperature', 0.7)),
|
743 |
gr.update(value=config.get('max_tokens', 750))
|
@@ -768,7 +794,7 @@ class SpaceGenerator:
|
|
768 |
return updates
|
769 |
|
770 |
except Exception as e:
|
771 |
-
error_updates = [gr.update() for _ in range(
|
772 |
error_updates.append(gr.update(
|
773 |
value=f"Error loading configuration: {str(e)}",
|
774 |
visible=True
|
@@ -778,7 +804,7 @@ class SpaceGenerator:
|
|
778 |
return error_updates
|
779 |
|
780 |
def _preview_configuration(self, name, tagline, description, system_prompt, model,
|
781 |
-
theme, api_key_var, temperature, max_tokens,
|
782 |
access_code, *args):
|
783 |
"""Preview the configuration"""
|
784 |
# Split args into examples and URLs
|
@@ -792,6 +818,7 @@ class SpaceGenerator:
|
|
792 |
'description': description or 'A versatile AI assistant powered by advanced language models.',
|
793 |
'system_prompt': system_prompt or 'You are a helpful AI assistant.',
|
794 |
'model': model,
|
|
|
795 |
'theme': theme,
|
796 |
'api_key_var': api_key_var,
|
797 |
'temperature': temperature,
|
@@ -806,7 +833,7 @@ class SpaceGenerator:
|
|
806 |
return config
|
807 |
|
808 |
def _generate_package(self, name, tagline, description, system_prompt, model,
|
809 |
-
theme, api_key_var, temperature, max_tokens,
|
810 |
access_code, *args):
|
811 |
"""Generate the deployment package"""
|
812 |
try:
|
@@ -839,7 +866,8 @@ class SpaceGenerator:
|
|
839 |
'grounding_urls': json.dumps(grounding_urls),
|
840 |
'enable_dynamic_urls': True,
|
841 |
'enable_file_upload': True,
|
842 |
-
'theme': repr(theme)
|
|
|
843 |
}
|
844 |
|
845 |
# Generate files
|
@@ -858,6 +886,7 @@ huggingface-hub>=0.20.0"""
|
|
858 |
'description': description or 'A versatile AI assistant powered by advanced language models.',
|
859 |
'system_prompt': system_prompt,
|
860 |
'model': model,
|
|
|
861 |
'api_key_var': api_key_var,
|
862 |
'temperature': temperature,
|
863 |
'max_tokens': int(max_tokens),
|
|
|
162 |
value="google/gemini-2.0-flash-001"
|
163 |
)
|
164 |
|
165 |
+
self.language_input = gr.Dropdown(
|
166 |
+
label="Language",
|
167 |
+
choices=[
|
168 |
+
"Arabic",
|
169 |
+
"Bengali",
|
170 |
+
"English",
|
171 |
+
"French",
|
172 |
+
"German",
|
173 |
+
"Hindi",
|
174 |
+
"Italian",
|
175 |
+
"Japanese",
|
176 |
+
"Korean",
|
177 |
+
"Mandarin",
|
178 |
+
"Portuguese",
|
179 |
+
"Russian",
|
180 |
+
"Spanish",
|
181 |
+
"Turkish"
|
182 |
+
],
|
183 |
+
value="English"
|
184 |
+
)
|
185 |
+
|
186 |
with gr.Row():
|
187 |
self.temperature_input = gr.Slider(
|
188 |
label="Temperature",
|
|
|
333 |
inputs=[
|
334 |
template_selector, self.previous_template, self.template_cache,
|
335 |
self.name_input, self.tagline_input, self.description_input, self.system_prompt_input,
|
336 |
+
self.model_input, self.language_input, self.temperature_input, self.max_tokens_input
|
337 |
] + self.example_inputs + self.url_inputs,
|
338 |
outputs=[
|
339 |
self.name_input, self.tagline_input, self.description_input, self.system_prompt_input,
|
340 |
+
self.model_input, self.language_input, self.temperature_input, self.max_tokens_input
|
341 |
] + self.example_inputs + self.url_inputs + [self.previous_template, self.template_cache]
|
342 |
)
|
343 |
|
|
|
346 |
inputs=[config_upload],
|
347 |
outputs=[
|
348 |
self.name_input, self.tagline_input, self.description_input, self.system_prompt_input,
|
349 |
+
self.model_input, self.language_input, self.theme_input, self.temperature_input,
|
350 |
self.max_tokens_input, upload_status
|
351 |
] + self.example_inputs + self.url_inputs
|
352 |
)
|
|
|
418 |
self._preview_configuration,
|
419 |
inputs=[
|
420 |
self.name_input, self.tagline_input, self.description_input, self.system_prompt_input,
|
421 |
+
self.model_input, self.language_input, self.theme_input, self.api_key_var_input,
|
422 |
self.temperature_input, self.max_tokens_input, self.access_code_input
|
423 |
] + self.example_inputs + self.url_inputs,
|
424 |
outputs=[self.config_state]
|
|
|
431 |
self._generate_package,
|
432 |
inputs=[
|
433 |
self.name_input, self.tagline_input, self.description_input, self.system_prompt_input,
|
434 |
+
self.model_input, self.language_input, self.theme_input, self.api_key_var_input,
|
435 |
self.temperature_input, self.max_tokens_input, self.access_code_input
|
436 |
] + self.example_inputs + self.url_inputs,
|
437 |
outputs=[
|
|
|
629 |
create_support_docs()
|
630 |
|
631 |
def _apply_template(self, template_name, prev_template, cache,
|
632 |
+
name, tagline, desc, prompt, model, language, temp, tokens, *args):
|
633 |
"""Apply selected template to form fields with caching"""
|
634 |
# Split args into examples and URLs
|
635 |
example_values = args[:5] # First 5 are examples
|
|
|
646 |
'description': desc,
|
647 |
'system_prompt': prompt,
|
648 |
'model': model,
|
649 |
+
'language': language,
|
650 |
'temperature': temp,
|
651 |
'max_tokens': tokens,
|
652 |
'examples': examples_list,
|
|
|
683 |
gr.update(value=custom.get('description', '')),
|
684 |
gr.update(value=custom.get('system_prompt', '')),
|
685 |
gr.update(value=custom.get('model', 'google/gemini-2.0-flash-001')),
|
686 |
+
gr.update(value=custom.get('language', 'English')),
|
687 |
gr.update(value=custom.get('temperature', 0.7)),
|
688 |
gr.update(value=custom.get('max_tokens', 750))
|
689 |
] + example_updates + url_updates + [template_name, cache]
|
|
|
705 |
gr.update(value='A versatile AI assistant powered by advanced language models.'),
|
706 |
gr.update(value='You are a helpful AI assistant.'),
|
707 |
gr.update(value='google/gemini-2.0-flash-001'),
|
708 |
+
gr.update(value='English'),
|
709 |
gr.update(value=0.7),
|
710 |
gr.update(value=750)
|
711 |
] + example_updates + url_updates + [template_name, cache]
|
|
|
737 |
gr.update(value=template.get('description', '')),
|
738 |
gr.update(value=template.get('system_prompt', '')),
|
739 |
gr.update(value=template.get('model', 'google/gemini-2.0-flash-001')),
|
740 |
+
gr.update(value=template.get('language', 'English')),
|
741 |
gr.update(value=template.get('temperature', 0.7)),
|
742 |
gr.update(value=template.get('max_tokens', 750))
|
743 |
] + example_updates + url_updates + [template_name, cache]
|
744 |
else:
|
745 |
# Invalid template, no updates
|
746 |
+
# 8 basic fields + 5 examples + 10 URLs = 23, plus prev_template and cache = 25 total
|
747 |
+
return [gr.update() for _ in range(23)] + [prev_template, cache]
|
748 |
|
749 |
def _apply_uploaded_config(self, config_file):
|
750 |
"""Apply uploaded configuration file"""
|
751 |
if not config_file:
|
752 |
+
# 9 basic + 1 status + 5 examples + 10 URLs = 25 total
|
753 |
+
return [gr.update() for _ in range(25)]
|
754 |
|
755 |
try:
|
756 |
with open(config_file, 'r') as f:
|
|
|
763 |
gr.update(value=config.get('description', '')),
|
764 |
gr.update(value=config.get('system_prompt', '')),
|
765 |
gr.update(value=config.get('model', 'google/gemini-2.0-flash-001')),
|
766 |
+
gr.update(value=config.get('language', 'English')),
|
767 |
gr.update(value=config.get('theme', 'Default')),
|
768 |
gr.update(value=config.get('temperature', 0.7)),
|
769 |
gr.update(value=config.get('max_tokens', 750))
|
|
|
794 |
return updates
|
795 |
|
796 |
except Exception as e:
|
797 |
+
error_updates = [gr.update() for _ in range(9)] # Basic fields
|
798 |
error_updates.append(gr.update(
|
799 |
value=f"Error loading configuration: {str(e)}",
|
800 |
visible=True
|
|
|
804 |
return error_updates
|
805 |
|
806 |
def _preview_configuration(self, name, tagline, description, system_prompt, model,
|
807 |
+
language, theme, api_key_var, temperature, max_tokens,
|
808 |
access_code, *args):
|
809 |
"""Preview the configuration"""
|
810 |
# Split args into examples and URLs
|
|
|
818 |
'description': description or 'A versatile AI assistant powered by advanced language models.',
|
819 |
'system_prompt': system_prompt or 'You are a helpful AI assistant.',
|
820 |
'model': model,
|
821 |
+
'language': language,
|
822 |
'theme': theme,
|
823 |
'api_key_var': api_key_var,
|
824 |
'temperature': temperature,
|
|
|
833 |
return config
|
834 |
|
835 |
def _generate_package(self, name, tagline, description, system_prompt, model,
|
836 |
+
language, theme, api_key_var, temperature, max_tokens,
|
837 |
access_code, *args):
|
838 |
"""Generate the deployment package"""
|
839 |
try:
|
|
|
866 |
'grounding_urls': json.dumps(grounding_urls),
|
867 |
'enable_dynamic_urls': True,
|
868 |
'enable_file_upload': True,
|
869 |
+
'theme': repr(theme),
|
870 |
+
'language': repr(language)
|
871 |
}
|
872 |
|
873 |
# Generate files
|
|
|
886 |
'description': description or 'A versatile AI assistant powered by advanced language models.',
|
887 |
'system_prompt': system_prompt,
|
888 |
'model': model,
|
889 |
+
'language': language,
|
890 |
'api_key_var': api_key_var,
|
891 |
'temperature': temperature,
|
892 |
'max_tokens': int(max_tokens),
|
space_template.py
CHANGED
@@ -34,6 +34,7 @@ DEFAULT_CONFIG = {{
|
|
34 |
'enable_dynamic_urls': {enable_dynamic_urls},
|
35 |
'enable_file_upload': {enable_file_upload},
|
36 |
'examples': {examples},
|
|
|
37 |
'locked': False
|
38 |
}}
|
39 |
|
@@ -141,6 +142,7 @@ THEME = config.get('theme', DEFAULT_CONFIG['theme'])
|
|
141 |
GROUNDING_URLS = config.get('grounding_urls', DEFAULT_CONFIG['grounding_urls'])
|
142 |
ENABLE_DYNAMIC_URLS = config.get('enable_dynamic_urls', DEFAULT_CONFIG['enable_dynamic_urls'])
|
143 |
ENABLE_FILE_UPLOAD = config.get('enable_file_upload', DEFAULT_CONFIG.get('enable_file_upload', True))
|
|
|
144 |
|
145 |
# Environment variables
|
146 |
ACCESS_CODE = os.environ.get("ACCESS_CODE")
|
@@ -756,6 +758,27 @@ def create_interface():
|
|
756 |
allow_custom_value=True
|
757 |
)
|
758 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
759 |
edit_description = gr.Textbox(
|
760 |
label="Description",
|
761 |
value=config.get('description', ''),
|
@@ -819,7 +842,7 @@ def create_interface():
|
|
819 |
|
820 |
config_status = gr.Markdown()
|
821 |
|
822 |
-
def save_configuration(name, description, system_prompt, model, temp, tokens, examples, grounding_urls, enable_dynamic_urls, enable_file_upload):
|
823 |
"""Save updated configuration"""
|
824 |
try:
|
825 |
updated_config = config.copy()
|
@@ -828,6 +851,7 @@ def create_interface():
|
|
828 |
'description': description,
|
829 |
'system_prompt': system_prompt,
|
830 |
'model': model,
|
|
|
831 |
'temperature': temp,
|
832 |
'max_tokens': int(tokens),
|
833 |
'examples': [ex.strip() for ex in examples.split('\\n') if ex.strip()],
|
@@ -872,7 +896,7 @@ def create_interface():
|
|
872 |
|
873 |
save_btn.click(
|
874 |
save_configuration,
|
875 |
-
inputs=[edit_name, edit_description, edit_system_prompt, edit_model,
|
876 |
edit_temperature, edit_max_tokens, edit_examples, edit_grounding_urls,
|
877 |
edit_enable_dynamic_urls, edit_enable_file_upload],
|
878 |
outputs=[config_status]
|
@@ -887,6 +911,7 @@ def create_interface():
|
|
887 |
DEFAULT_CONFIG['description'],
|
888 |
DEFAULT_CONFIG['system_prompt'],
|
889 |
DEFAULT_CONFIG['model'],
|
|
|
890 |
DEFAULT_CONFIG['temperature'],
|
891 |
DEFAULT_CONFIG['max_tokens'],
|
892 |
'\\n'.join(DEFAULT_CONFIG['examples']),
|
@@ -896,13 +921,13 @@ def create_interface():
|
|
896 |
"β
Reset to default configuration"
|
897 |
)
|
898 |
else:
|
899 |
-
return (*[gr.update() for _ in range(
|
900 |
except Exception as e:
|
901 |
-
return (*[gr.update() for _ in range(
|
902 |
|
903 |
reset_btn.click(
|
904 |
reset_configuration,
|
905 |
-
outputs=[edit_name, edit_description, edit_system_prompt, edit_model,
|
906 |
edit_temperature, edit_max_tokens, edit_examples, edit_grounding_urls,
|
907 |
edit_enable_dynamic_urls, edit_enable_file_upload, config_status]
|
908 |
)
|
@@ -995,7 +1020,7 @@ def validate_template():
|
|
995 |
required_placeholders = [
|
996 |
'name', 'description', 'system_prompt', 'temperature', 'max_tokens',
|
997 |
'model', 'api_key_var', 'theme', 'grounding_urls', 'enable_dynamic_urls',
|
998 |
-
'enable_file_upload', 'examples'
|
999 |
]
|
1000 |
|
1001 |
missing = []
|
|
|
34 |
'enable_dynamic_urls': {enable_dynamic_urls},
|
35 |
'enable_file_upload': {enable_file_upload},
|
36 |
'examples': {examples},
|
37 |
+
'language': {language},
|
38 |
'locked': False
|
39 |
}}
|
40 |
|
|
|
142 |
GROUNDING_URLS = config.get('grounding_urls', DEFAULT_CONFIG['grounding_urls'])
|
143 |
ENABLE_DYNAMIC_URLS = config.get('enable_dynamic_urls', DEFAULT_CONFIG['enable_dynamic_urls'])
|
144 |
ENABLE_FILE_UPLOAD = config.get('enable_file_upload', DEFAULT_CONFIG.get('enable_file_upload', True))
|
145 |
+
LANGUAGE = config.get('language', DEFAULT_CONFIG.get('language', 'English'))
|
146 |
|
147 |
# Environment variables
|
148 |
ACCESS_CODE = os.environ.get("ACCESS_CODE")
|
|
|
758 |
allow_custom_value=True
|
759 |
)
|
760 |
|
761 |
+
edit_language = gr.Dropdown(
|
762 |
+
label="Language",
|
763 |
+
choices=[
|
764 |
+
"Arabic",
|
765 |
+
"Bengali",
|
766 |
+
"English",
|
767 |
+
"French",
|
768 |
+
"German",
|
769 |
+
"Hindi",
|
770 |
+
"Italian",
|
771 |
+
"Japanese",
|
772 |
+
"Korean",
|
773 |
+
"Mandarin",
|
774 |
+
"Portuguese",
|
775 |
+
"Russian",
|
776 |
+
"Spanish",
|
777 |
+
"Turkish"
|
778 |
+
],
|
779 |
+
value=config.get('language', 'English')
|
780 |
+
)
|
781 |
+
|
782 |
edit_description = gr.Textbox(
|
783 |
label="Description",
|
784 |
value=config.get('description', ''),
|
|
|
842 |
|
843 |
config_status = gr.Markdown()
|
844 |
|
845 |
+
def save_configuration(name, description, system_prompt, model, language, temp, tokens, examples, grounding_urls, enable_dynamic_urls, enable_file_upload):
|
846 |
"""Save updated configuration"""
|
847 |
try:
|
848 |
updated_config = config.copy()
|
|
|
851 |
'description': description,
|
852 |
'system_prompt': system_prompt,
|
853 |
'model': model,
|
854 |
+
'language': language,
|
855 |
'temperature': temp,
|
856 |
'max_tokens': int(tokens),
|
857 |
'examples': [ex.strip() for ex in examples.split('\\n') if ex.strip()],
|
|
|
896 |
|
897 |
save_btn.click(
|
898 |
save_configuration,
|
899 |
+
inputs=[edit_name, edit_description, edit_system_prompt, edit_model, edit_language,
|
900 |
edit_temperature, edit_max_tokens, edit_examples, edit_grounding_urls,
|
901 |
edit_enable_dynamic_urls, edit_enable_file_upload],
|
902 |
outputs=[config_status]
|
|
|
911 |
DEFAULT_CONFIG['description'],
|
912 |
DEFAULT_CONFIG['system_prompt'],
|
913 |
DEFAULT_CONFIG['model'],
|
914 |
+
DEFAULT_CONFIG.get('language', 'English'),
|
915 |
DEFAULT_CONFIG['temperature'],
|
916 |
DEFAULT_CONFIG['max_tokens'],
|
917 |
'\\n'.join(DEFAULT_CONFIG['examples']),
|
|
|
921 |
"β
Reset to default configuration"
|
922 |
)
|
923 |
else:
|
924 |
+
return (*[gr.update() for _ in range(11)], "β Failed to reset")
|
925 |
except Exception as e:
|
926 |
+
return (*[gr.update() for _ in range(11)], f"β Error: {{str(e)}}")
|
927 |
|
928 |
reset_btn.click(
|
929 |
reset_configuration,
|
930 |
+
outputs=[edit_name, edit_description, edit_system_prompt, edit_model, edit_language,
|
931 |
edit_temperature, edit_max_tokens, edit_examples, edit_grounding_urls,
|
932 |
edit_enable_dynamic_urls, edit_enable_file_upload, config_status]
|
933 |
)
|
|
|
1020 |
required_placeholders = [
|
1021 |
'name', 'description', 'system_prompt', 'temperature', 'max_tokens',
|
1022 |
'model', 'api_key_var', 'theme', 'grounding_urls', 'enable_dynamic_urls',
|
1023 |
+
'enable_file_upload', 'examples', 'language'
|
1024 |
]
|
1025 |
|
1026 |
missing = []
|