milwright commited on
Commit
f3584a0
Β·
verified Β·
1 Parent(s): 62c04ea

Upload 4 files

Browse files
Files changed (3) hide show
  1. README.md +3 -3
  2. app.py +38 -8
  3. config.json +5 -6
README.md CHANGED
@@ -8,12 +8,12 @@ sdk_version: 5.39.0
8
  app_file: app.py
9
  pinned: false
10
  license: mit
11
- short_description: Interactive STEM adventure game guide for students at Baruch
12
  ---
13
 
14
  # STEM Adventure Games
15
 
16
- Interactive STEM adventure game guide for students enrolled in science, technology, engineering, and management classes at Baruch College, CUNY.
17
 
18
  ## Quick Setup
19
 
@@ -42,7 +42,7 @@ Interactive STEM adventure game guide for students enrolled in science, technolo
42
  Your Space should now be running! Try the example prompts or ask your own questions.
43
 
44
  ## Configuration
45
- - **Model**: openai/gpt-4.1-nano
46
  - **API Key Variable**: API_KEY
47
  - **HF Token Variable**: HF_TOKEN (for auto-updates)
48
  - **Access Control**: Enabled (ACCESS_CODE)
 
8
  app_file: app.py
9
  pinned: false
10
  license: mit
11
+ short_description: Interactive STEM adventure game guide
12
  ---
13
 
14
  # STEM Adventure Games
15
 
16
+ Interactive STEM adventure game guide
17
 
18
  ## Quick Setup
19
 
 
42
  Your Space should now be running! Try the example prompts or ask your own questions.
43
 
44
  ## Configuration
45
+ - **Model**: qwen/qwen3-30b-a3b-instruct-2507
46
  - **API Key Variable**: API_KEY
47
  - **HF Token Variable**: HF_TOKEN (for auto-updates)
48
  - **Access Control**: Enabled (ACCESS_CODE)
app.py CHANGED
@@ -13,7 +13,7 @@ from typing import List, Dict, Optional, Any, Tuple
13
 
14
  # Configuration
15
  SPACE_NAME = 'STEM Adventure Games'
16
- SPACE_DESCRIPTION = 'Interactive STEM adventure game guide for students at Baruch'
17
 
18
  # Default configuration values
19
  DEFAULT_CONFIG = {
@@ -22,9 +22,9 @@ DEFAULT_CONFIG = {
22
  'system_prompt': "Simulate an interactive game-based learning experience through Choose Your Own STEM Adventure games featuring historically significant scientific experiments. Open each session with an unicode-styled arcade menu that reads 'STEM_ADV_GAMES` one stacked on top of the other. Underneath, frame the game in two sentences and widely sample 3-4 optional adventures from Wikipedia's List of Experiments. In the first stage, be brief and incrementally build more narrative content into the chat, immersing players in vivid historical moments written in second person (e.g. 'You are Galileo Galilei') that establish the year, location, prevailing beliefs, and tensions between established wisdom and emerging observations. Each section has 4 numbered decision points per stage that reflect experimental choices that subtly demonstrate a facet of the scientific method, with each choice meaningfully distinct in affording paths forward. Always end scenes with new branching choices that build a narrative progression based on concrete experimental procedures in laboratory environments. Offer backtracking options to emphasize how so-called failed experiments provide insights, balancing historical accuracy with engaging gameplay that shows how systematic thinking and creative problem-solving combine in scientific breakthroughs. Simulate a playful tone and arcade-styled aesthetic to keep the experience fun and engaging, while still being educational.",
23
  'temperature': 0.9,
24
  'max_tokens': 750,
25
- 'model': 'openai/gpt-4.1-nano',
26
  'api_key_var': 'API_KEY',
27
- 'theme': 'Base',
28
  'grounding_urls': ["https://en.wikipedia.org/wiki/List_of_experiments", "https://en.wikipedia.org/wiki/Scientific_method"],
29
  'enable_dynamic_urls': True,
30
  'enable_file_upload': True,
@@ -755,6 +755,28 @@ def create_interface():
755
  lines=3
756
  )
757
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
758
  # Configuration actions
759
  with gr.Row():
760
  save_btn = gr.Button("πŸ’Ύ Save Configuration", variant="primary")
@@ -762,7 +784,7 @@ def create_interface():
762
 
763
  config_status = gr.Markdown()
764
 
765
- def save_configuration(name, description, system_prompt, model, temp, tokens, examples):
766
  """Save updated configuration"""
767
  try:
768
  updated_config = config.copy()
@@ -774,6 +796,9 @@ def create_interface():
774
  'temperature': temp,
775
  'max_tokens': int(tokens),
776
  'examples': [ex.strip() for ex in examples.split('\n') if ex.strip()],
 
 
 
777
  'locked': config.get('locked', False)
778
  })
779
 
@@ -813,7 +838,8 @@ def create_interface():
813
  save_btn.click(
814
  save_configuration,
815
  inputs=[edit_name, edit_description, edit_system_prompt, edit_model,
816
- edit_temperature, edit_max_tokens, edit_examples],
 
817
  outputs=[config_status]
818
  )
819
 
@@ -829,17 +855,21 @@ def create_interface():
829
  DEFAULT_CONFIG['temperature'],
830
  DEFAULT_CONFIG['max_tokens'],
831
  '\n'.join(DEFAULT_CONFIG['examples']),
 
 
 
832
  "βœ… Reset to default configuration"
833
  )
834
  else:
835
- return (*[gr.update() for _ in range(7)], "❌ Failed to reset")
836
  except Exception as e:
837
- return (*[gr.update() for _ in range(7)], f"❌ Error: {str(e)}")
838
 
839
  reset_btn.click(
840
  reset_configuration,
841
  outputs=[edit_name, edit_description, edit_system_prompt, edit_model,
842
- edit_temperature, edit_max_tokens, edit_examples, config_status]
 
843
  )
844
 
845
  # Access control handler
 
13
 
14
  # Configuration
15
  SPACE_NAME = 'STEM Adventure Games'
16
+ SPACE_DESCRIPTION = 'Interactive STEM adventure game guide'
17
 
18
  # Default configuration values
19
  DEFAULT_CONFIG = {
 
22
  'system_prompt': "Simulate an interactive game-based learning experience through Choose Your Own STEM Adventure games featuring historically significant scientific experiments. Open each session with an unicode-styled arcade menu that reads 'STEM_ADV_GAMES` one stacked on top of the other. Underneath, frame the game in two sentences and widely sample 3-4 optional adventures from Wikipedia's List of Experiments. In the first stage, be brief and incrementally build more narrative content into the chat, immersing players in vivid historical moments written in second person (e.g. 'You are Galileo Galilei') that establish the year, location, prevailing beliefs, and tensions between established wisdom and emerging observations. Each section has 4 numbered decision points per stage that reflect experimental choices that subtly demonstrate a facet of the scientific method, with each choice meaningfully distinct in affording paths forward. Always end scenes with new branching choices that build a narrative progression based on concrete experimental procedures in laboratory environments. Offer backtracking options to emphasize how so-called failed experiments provide insights, balancing historical accuracy with engaging gameplay that shows how systematic thinking and creative problem-solving combine in scientific breakthroughs. Simulate a playful tone and arcade-styled aesthetic to keep the experience fun and engaging, while still being educational.",
23
  'temperature': 0.9,
24
  'max_tokens': 750,
25
+ 'model': 'qwen/qwen3-30b-a3b-instruct-2507',
26
  'api_key_var': 'API_KEY',
27
+ 'theme': 'Monochrome',
28
  'grounding_urls': ["https://en.wikipedia.org/wiki/List_of_experiments", "https://en.wikipedia.org/wiki/Scientific_method"],
29
  'enable_dynamic_urls': True,
30
  'enable_file_upload': True,
 
755
  lines=3
756
  )
757
 
758
+ # URL Grounding
759
+ gr.Markdown("### URL Grounding")
760
+ edit_grounding_urls = gr.Textbox(
761
+ label="Grounding URLs (one per line)",
762
+ placeholder="https://example.com/docs\nhttps://example.com/api",
763
+ value='\n'.join(config.get('grounding_urls', [])),
764
+ lines=5,
765
+ info="Add URLs to provide context. First 2 URLs are primary sources."
766
+ )
767
+
768
+ with gr.Row():
769
+ edit_enable_dynamic_urls = gr.Checkbox(
770
+ label="Enable Dynamic URL Extraction",
771
+ value=config.get('enable_dynamic_urls', True),
772
+ info="Extract and fetch URLs from user messages"
773
+ )
774
+ edit_enable_file_upload = gr.Checkbox(
775
+ label="Enable File Upload",
776
+ value=config.get('enable_file_upload', True),
777
+ info="Allow users to upload files for context"
778
+ )
779
+
780
  # Configuration actions
781
  with gr.Row():
782
  save_btn = gr.Button("πŸ’Ύ Save Configuration", variant="primary")
 
784
 
785
  config_status = gr.Markdown()
786
 
787
+ def save_configuration(name, description, system_prompt, model, temp, tokens, examples, grounding_urls, enable_dynamic_urls, enable_file_upload):
788
  """Save updated configuration"""
789
  try:
790
  updated_config = config.copy()
 
796
  'temperature': temp,
797
  'max_tokens': int(tokens),
798
  'examples': [ex.strip() for ex in examples.split('\n') if ex.strip()],
799
+ 'grounding_urls': [url.strip() for url in grounding_urls.split('\n') if url.strip()],
800
+ 'enable_dynamic_urls': enable_dynamic_urls,
801
+ 'enable_file_upload': enable_file_upload,
802
  'locked': config.get('locked', False)
803
  })
804
 
 
838
  save_btn.click(
839
  save_configuration,
840
  inputs=[edit_name, edit_description, edit_system_prompt, edit_model,
841
+ edit_temperature, edit_max_tokens, edit_examples, edit_grounding_urls,
842
+ edit_enable_dynamic_urls, edit_enable_file_upload],
843
  outputs=[config_status]
844
  )
845
 
 
855
  DEFAULT_CONFIG['temperature'],
856
  DEFAULT_CONFIG['max_tokens'],
857
  '\n'.join(DEFAULT_CONFIG['examples']),
858
+ '\n'.join(DEFAULT_CONFIG['grounding_urls']),
859
+ DEFAULT_CONFIG['enable_dynamic_urls'],
860
+ DEFAULT_CONFIG['enable_file_upload'],
861
  "βœ… Reset to default configuration"
862
  )
863
  else:
864
+ return (*[gr.update() for _ in range(10)], "❌ Failed to reset")
865
  except Exception as e:
866
+ return (*[gr.update() for _ in range(10)], f"❌ Error: {str(e)}")
867
 
868
  reset_btn.click(
869
  reset_configuration,
870
  outputs=[edit_name, edit_description, edit_system_prompt, edit_model,
871
+ edit_temperature, edit_max_tokens, edit_examples, edit_grounding_urls,
872
+ edit_enable_dynamic_urls, edit_enable_file_upload, config_status]
873
  )
874
 
875
  # Access control handler
config.json CHANGED
@@ -1,11 +1,11 @@
1
  {
2
  "name": "STEM Adventure Games",
3
- "tagline": "Interactive STEM adventure game guide for students at Baruch",
4
- "description": "Interactive STEM adventure game guide for students enrolled in science, technology, engineering, and management classes at Baruch College, CUNY. ",
5
  "system_prompt": "Simulate an interactive game-based learning experience through Choose Your Own STEM Adventure games featuring historically significant scientific experiments. Open each session with an unicode-styled arcade menu that reads 'STEM_ADV_GAMES` one stacked on top of the other. Underneath, frame the game in two sentences and widely sample 3-4 optional adventures from Wikipedia's List of Experiments. In the first stage, be brief and incrementally build more narrative content into the chat, immersing players in vivid historical moments written in second person (e.g. 'You are Galileo Galilei') that establish the year, location, prevailing beliefs, and tensions between established wisdom and emerging observations. Each section has 4 numbered decision points per stage that reflect experimental choices that subtly demonstrate a facet of the scientific method, with each choice meaningfully distinct in affording paths forward. Always end scenes with new branching choices that build a narrative progression based on concrete experimental procedures in laboratory environments. Offer backtracking options to emphasize how so-called failed experiments provide insights, balancing historical accuracy with engaging gameplay that shows how systematic thinking and creative problem-solving combine in scientific breakthroughs. Simulate a playful tone and arcade-styled aesthetic to keep the experience fun and engaging, while still being educational.",
6
- "model": "anthropic/claude-3.5-haiku",
7
  "api_key_var": "API_KEY",
8
- "temperature": 1.5,
9
  "max_tokens": 750,
10
  "examples": [
11
  "Initiate adventure!",
@@ -18,6 +18,5 @@
18
  ],
19
  "enable_dynamic_urls": true,
20
  "enable_file_upload": true,
21
- "theme": "Base",
22
- "locked": false
23
  }
 
1
  {
2
  "name": "STEM Adventure Games",
3
+ "tagline": "Interactive STEM adventure game guide",
4
+ "description": "Interactive STEM adventure game guide",
5
  "system_prompt": "Simulate an interactive game-based learning experience through Choose Your Own STEM Adventure games featuring historically significant scientific experiments. Open each session with an unicode-styled arcade menu that reads 'STEM_ADV_GAMES` one stacked on top of the other. Underneath, frame the game in two sentences and widely sample 3-4 optional adventures from Wikipedia's List of Experiments. In the first stage, be brief and incrementally build more narrative content into the chat, immersing players in vivid historical moments written in second person (e.g. 'You are Galileo Galilei') that establish the year, location, prevailing beliefs, and tensions between established wisdom and emerging observations. Each section has 4 numbered decision points per stage that reflect experimental choices that subtly demonstrate a facet of the scientific method, with each choice meaningfully distinct in affording paths forward. Always end scenes with new branching choices that build a narrative progression based on concrete experimental procedures in laboratory environments. Offer backtracking options to emphasize how so-called failed experiments provide insights, balancing historical accuracy with engaging gameplay that shows how systematic thinking and creative problem-solving combine in scientific breakthroughs. Simulate a playful tone and arcade-styled aesthetic to keep the experience fun and engaging, while still being educational.",
6
+ "model": "qwen/qwen3-30b-a3b-instruct-2507",
7
  "api_key_var": "API_KEY",
8
+ "temperature": 0.9,
9
  "max_tokens": 750,
10
  "examples": [
11
  "Initiate adventure!",
 
18
  ],
19
  "enable_dynamic_urls": true,
20
  "enable_file_upload": true,
21
+ "theme": "Monochrome"
 
22
  }