Spaces:
Running
Running
v1.14 STEM Template
Browse files- README.md +26 -56
- app.py +5 -8
- config.json +12 -4
README.md
CHANGED
|
@@ -1,75 +1,45 @@
|
|
| 1 |
---
|
| 2 |
-
|
|
|
|
| 3 |
colorFrom: blue
|
| 4 |
colorTo: green
|
| 5 |
-
emoji: 🤖
|
| 6 |
-
license: mit
|
| 7 |
-
pinned: false
|
| 8 |
sdk: gradio
|
| 9 |
sdk_version: 5.39.0
|
| 10 |
-
|
| 11 |
-
|
|
|
|
|
|
|
| 12 |
---
|
| 13 |
|
| 14 |
# STEM Adventure Games
|
| 15 |
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
## Quick Deploy to HuggingFace Spaces
|
| 19 |
|
| 20 |
-
|
| 21 |
-
1. Go to https://huggingface.co/spaces
|
| 22 |
-
2. Click "Create new Space"
|
| 23 |
-
3. Choose a name for your Space
|
| 24 |
-
4. Select **Gradio** as the SDK
|
| 25 |
-
5. Set visibility (Public/Private)
|
| 26 |
-
6. Click "Create Space"
|
| 27 |
|
| 28 |
-
### Step
|
| 29 |
-
1.
|
| 30 |
-
2.
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
- `config.json`
|
| 34 |
-
- `README.md`
|
| 35 |
-
3. Wait for "Building" to complete
|
| 36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
-
### Step 3: Add Access Code (Required)
|
| 39 |
-
1. In Settings, click "Variables and secrets"
|
| 40 |
-
2. Click "New secret"
|
| 41 |
-
3. Name: `ACCESS_CODE`
|
| 42 |
-
4. Value: Your chosen access code/password
|
| 43 |
-
5. Click "Add"
|
| 44 |
-
6. **Important**: Share this code with your students!
|
| 45 |
|
| 46 |
-
### Step 4: Add OpenRouter API Key
|
| 47 |
-
1. Get your API key from https://openrouter.ai/keys
|
| 48 |
-
2. In your Space Settings, click "Variables and secrets"
|
| 49 |
-
3. Click "New secret"
|
| 50 |
-
4. Name: `API_KEY`
|
| 51 |
-
5. Value: Your OpenRouter API key (starts with `sk-or-`)
|
| 52 |
-
6. Click "Add"
|
| 53 |
|
| 54 |
-
### Step
|
| 55 |
-
|
| 56 |
-
- Your Space should be running!
|
| 57 |
-
- Try the example prompts or ask a question
|
| 58 |
|
| 59 |
## Configuration
|
| 60 |
-
|
| 61 |
-
- **Model**: google/gemma-3-27b-it
|
| 62 |
- **API Key Variable**: API_KEY
|
| 63 |
-
- **
|
| 64 |
-
|
| 65 |
-
## Faculty Configuration
|
| 66 |
-
|
| 67 |
-
If you set `HF_TOKEN` and `SPACE_ID` environment variables, a Configuration tab will appear allowing you to:
|
| 68 |
-
- Edit the system prompt
|
| 69 |
-
- Change the AI model
|
| 70 |
-
- Update example prompts
|
| 71 |
-
- Modify grounding URLs
|
| 72 |
-
- Adjust temperature and response length
|
| 73 |
-
- Lock configuration to prevent further changes
|
| 74 |
|
| 75 |
-
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: STEM Adventure Games
|
| 3 |
+
emoji: 💬
|
| 4 |
colorFrom: blue
|
| 5 |
colorTo: green
|
|
|
|
|
|
|
|
|
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 5.39.0
|
| 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 |
|
| 20 |
+
### Step 1: Configure API Key (Required)
|
| 21 |
+
1. Get your API key from https://openrouter.ai/keys
|
| 22 |
+
2. In Settings → Variables and secrets
|
| 23 |
+
3. Add secret: `API_KEY`
|
| 24 |
+
4. Paste your OpenRouter API key
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
+
### Step 2: Configure HuggingFace Token (Optional)
|
| 27 |
+
1. Get your token from https://huggingface.co/settings/tokens
|
| 28 |
+
2. In Settings → Variables and secrets
|
| 29 |
+
3. Add secret: `HF_TOKEN`
|
| 30 |
+
4. Paste your HuggingFace token (needs write permissions)
|
| 31 |
+
5. This enables automatic configuration updates
|
| 32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
+
### Step 3: Test Your Space
|
| 36 |
+
Your Space should now be running! Try the example prompts or ask your own questions.
|
|
|
|
|
|
|
| 37 |
|
| 38 |
## Configuration
|
| 39 |
+
- **Model**: google/gemini-2.0-flash-001
|
|
|
|
| 40 |
- **API Key Variable**: API_KEY
|
| 41 |
+
- **HF Token Variable**: HF_TOKEN (for auto-updates)
|
| 42 |
+
- **Access**: Public
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
+
## Support
|
| 45 |
+
For help, visit the HuggingFace documentation or community forums.
|
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
|
| 17 |
|
| 18 |
# Default configuration values
|
| 19 |
DEFAULT_CONFIG = {
|
|
@@ -22,10 +22,10 @@ DEFAULT_CONFIG = {
|
|
| 22 |
'system_prompt': "Transform into an interactive co-learning guide who creates Choose Your Own STEM Adventure games featuring historically significant scientific experiments, opening each session with an eye-catching unicode-styled arcade menu presenting 5-6 adventures drawn from Wikipedia's List of Experiments with brief enticing descriptions, then 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, presenting 3-4 numbered decision points per stage that reflect authentic scientific choices ranging from experimental design and measurement approaches to strategic decisions about convincing skeptics or timing publications, with each choice meaningfully different and leading to distinct paths forward, then narrating results with sensory details, colleague reactions, and unexpected observations that teach concepts naturally through unfolding drama rather than lectures, always ending scenes with new branching choices that maintain narrative momentum while reinforcing science as an iterative process of hypothesis, testing, and refinement, offering backtracking options to emphasize how so-called failed experiments provide crucial insights, balancing historical accuracy with engaging gameplay that shows how systematic thinking and creative problem-solving combine in scientific breakthroughs.",
|
| 23 |
'temperature': 0.6,
|
| 24 |
'max_tokens': 1000,
|
| 25 |
-
'model': '
|
| 26 |
'api_key_var': 'API_KEY',
|
| 27 |
-
'theme': '
|
| 28 |
-
'grounding_urls': [],
|
| 29 |
'enable_dynamic_urls': True,
|
| 30 |
'enable_file_upload': True,
|
| 31 |
'examples': ['Initiate adventure!', 'How do I play?', "What's the meaning of this?"],
|
|
@@ -623,10 +623,7 @@ def create_interface():
|
|
| 623 |
examples=formatted_examples,
|
| 624 |
type="messages",
|
| 625 |
additional_inputs=additional_inputs if additional_inputs else None,
|
| 626 |
-
submit_btn="Send"
|
| 627 |
-
clear_btn="Clear",
|
| 628 |
-
undo_btn=None,
|
| 629 |
-
retry_btn=None
|
| 630 |
)
|
| 631 |
|
| 632 |
# Export functionality using DownloadButton
|
|
|
|
| 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': "Transform into an interactive co-learning guide who creates Choose Your Own STEM Adventure games featuring historically significant scientific experiments, opening each session with an eye-catching unicode-styled arcade menu presenting 5-6 adventures drawn from Wikipedia's List of Experiments with brief enticing descriptions, then 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, presenting 3-4 numbered decision points per stage that reflect authentic scientific choices ranging from experimental design and measurement approaches to strategic decisions about convincing skeptics or timing publications, with each choice meaningfully different and leading to distinct paths forward, then narrating results with sensory details, colleague reactions, and unexpected observations that teach concepts naturally through unfolding drama rather than lectures, always ending scenes with new branching choices that maintain narrative momentum while reinforcing science as an iterative process of hypothesis, testing, and refinement, offering backtracking options to emphasize how so-called failed experiments provide crucial insights, balancing historical accuracy with engaging gameplay that shows how systematic thinking and creative problem-solving combine in scientific breakthroughs.",
|
| 23 |
'temperature': 0.6,
|
| 24 |
'max_tokens': 1000,
|
| 25 |
+
'model': 'google/gemini-2.0-flash-001',
|
| 26 |
'api_key_var': 'API_KEY',
|
| 27 |
+
'theme': 'Soft',
|
| 28 |
+
'grounding_urls': ["https://en.wikipedia.org/wiki/List_of_experiments", "https://en.wikipedia.org/wiki/Scientific_method", "https://en.wikipedia.org/wiki/List_of_experiments#Biology", "https://en.wikipedia.org/wiki/List_of_experiments#Astronomy", "https://en.wikipedia.org/wiki/List_of_experiments#Chemistry", "https://en.wikipedia.org/wiki/List_of_experiments#Physics", "https://en.wikipedia.org/wiki/List_of_experiments#Geology"],
|
| 29 |
'enable_dynamic_urls': True,
|
| 30 |
'enable_file_upload': True,
|
| 31 |
'examples': ['Initiate adventure!', 'How do I play?', "What's the meaning of this?"],
|
|
|
|
| 623 |
examples=formatted_examples,
|
| 624 |
type="messages",
|
| 625 |
additional_inputs=additional_inputs if additional_inputs else None,
|
| 626 |
+
submit_btn="Send"
|
|
|
|
|
|
|
|
|
|
| 627 |
)
|
| 628 |
|
| 629 |
# Export functionality using DownloadButton
|
config.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
| 1 |
{
|
| 2 |
"name": "STEM Adventure Games",
|
| 3 |
-
"description": "Interactive
|
| 4 |
"system_prompt": "Transform into an interactive co-learning guide who creates Choose Your Own STEM Adventure games featuring historically significant scientific experiments, opening each session with an eye-catching unicode-styled arcade menu presenting 5-6 adventures drawn from Wikipedia's List of Experiments with brief enticing descriptions, then 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, presenting 3-4 numbered decision points per stage that reflect authentic scientific choices ranging from experimental design and measurement approaches to strategic decisions about convincing skeptics or timing publications, with each choice meaningfully different and leading to distinct paths forward, then narrating results with sensory details, colleague reactions, and unexpected observations that teach concepts naturally through unfolding drama rather than lectures, always ending scenes with new branching choices that maintain narrative momentum while reinforcing science as an iterative process of hypothesis, testing, and refinement, offering backtracking options to emphasize how so-called failed experiments provide crucial insights, balancing historical accuracy with engaging gameplay that shows how systematic thinking and creative problem-solving combine in scientific breakthroughs.",
|
| 5 |
-
"model": "
|
| 6 |
"api_key_var": "API_KEY",
|
| 7 |
"temperature": 0.6,
|
| 8 |
"max_tokens": 1000,
|
|
@@ -11,8 +11,16 @@
|
|
| 11 |
"How do I play?",
|
| 12 |
"What's the meaning of this?"
|
| 13 |
],
|
| 14 |
-
"grounding_urls": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
"enable_dynamic_urls": true,
|
| 16 |
"enable_file_upload": true,
|
| 17 |
-
"theme": "
|
| 18 |
}
|
|
|
|
| 1 |
{
|
| 2 |
"name": "STEM Adventure Games",
|
| 3 |
+
"description": "Interactive STEM adventure game guide",
|
| 4 |
"system_prompt": "Transform into an interactive co-learning guide who creates Choose Your Own STEM Adventure games featuring historically significant scientific experiments, opening each session with an eye-catching unicode-styled arcade menu presenting 5-6 adventures drawn from Wikipedia's List of Experiments with brief enticing descriptions, then 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, presenting 3-4 numbered decision points per stage that reflect authentic scientific choices ranging from experimental design and measurement approaches to strategic decisions about convincing skeptics or timing publications, with each choice meaningfully different and leading to distinct paths forward, then narrating results with sensory details, colleague reactions, and unexpected observations that teach concepts naturally through unfolding drama rather than lectures, always ending scenes with new branching choices that maintain narrative momentum while reinforcing science as an iterative process of hypothesis, testing, and refinement, offering backtracking options to emphasize how so-called failed experiments provide crucial insights, balancing historical accuracy with engaging gameplay that shows how systematic thinking and creative problem-solving combine in scientific breakthroughs.",
|
| 5 |
+
"model": "google/gemini-2.0-flash-001",
|
| 6 |
"api_key_var": "API_KEY",
|
| 7 |
"temperature": 0.6,
|
| 8 |
"max_tokens": 1000,
|
|
|
|
| 11 |
"How do I play?",
|
| 12 |
"What's the meaning of this?"
|
| 13 |
],
|
| 14 |
+
"grounding_urls": [
|
| 15 |
+
"https://en.wikipedia.org/wiki/List_of_experiments",
|
| 16 |
+
"https://en.wikipedia.org/wiki/Scientific_method",
|
| 17 |
+
"https://en.wikipedia.org/wiki/List_of_experiments#Biology",
|
| 18 |
+
"https://en.wikipedia.org/wiki/List_of_experiments#Astronomy",
|
| 19 |
+
"https://en.wikipedia.org/wiki/List_of_experiments#Chemistry",
|
| 20 |
+
"https://en.wikipedia.org/wiki/List_of_experiments#Physics",
|
| 21 |
+
"https://en.wikipedia.org/wiki/List_of_experiments#Geology"
|
| 22 |
+
],
|
| 23 |
"enable_dynamic_urls": true,
|
| 24 |
"enable_file_upload": true,
|
| 25 |
+
"theme": "Soft"
|
| 26 |
}
|