milwright commited on
Commit
24026d5
·
verified ·
1 Parent(s): 12aec11

Upload 3 files

Browse files
Files changed (2) hide show
  1. app.py +11 -8
  2. config.json +8 -7
app.py CHANGED
@@ -10,15 +10,16 @@ import urllib.parse
10
 
11
 
12
  # Configuration
13
- SPACE_NAME = "My Custom Space"
14
- SPACE_DESCRIPTION = " sadfsdf sadfs dfas. sfadfasdff fsdafsdfasdf. d"
15
- SYSTEM_PROMPT = """You are a pedagogically-minded academic assistant designed for introductory courses. Your approach follows constructivist learning principles: build on students' prior knowledge, scaffold complex concepts through graduated questioning, and use Socratic dialogue to guide discovery. Provide concise, evidence-based explanations that connect theory to lived experiences. Each response should model critical thinking by acknowledging multiple perspectives, identifying assumptions, and revealing conceptual relationships. Conclude with open-ended questions that promote higher-order thinking—analysis, synthesis, or evaluation—rather than recall."""
16
- MODEL = "anthropic/claude-3.5-haiku"
17
- GROUNDING_URLS = []
 
18
  # Get access code from environment variable for security
19
  # If SPACE_ACCESS_CODE is not set, no access control is applied
20
  ACCESS_CODE = os.environ.get("SPACE_ACCESS_CODE")
21
- ENABLE_DYNAMIC_URLS = True
22
 
23
  # Get API key from environment - customizable variable name with validation
24
  API_KEY = os.environ.get("OPENROUTER_API_KEY")
@@ -501,7 +502,9 @@ def get_configuration_status():
501
  return "\n".join(status_parts)
502
 
503
  # Create interface with access code protection
504
- with gr.Blocks(title=SPACE_NAME) as demo:
 
 
505
  gr.Markdown(f"# {SPACE_NAME}")
506
  gr.Markdown(SPACE_DESCRIPTION)
507
 
@@ -524,7 +527,7 @@ with gr.Blocks(title=SPACE_NAME) as demo:
524
  fn=store_and_generate_response, # Use wrapper function to store history
525
  title="", # Title already shown above
526
  description="", # Description already shown above
527
- examples=['How is this relevant?'],
528
  type="messages" # Use modern message format for better compatibility
529
  )
530
 
 
10
 
11
 
12
  # Configuration
13
+ SPACE_NAME = "AI Assistant"
14
+ SPACE_DESCRIPTION = "A customizable AI assistant"
15
+ SYSTEM_PROMPT = """You are an AI assistant specialized in mathematics and statistics who guides users through problem-solving rather than providing direct answers. You help users discover solutions by asking strategic questions ('What do we know so far?' 'What method might apply here?' 'Can you identify a pattern?'), prompting them to explain their reasoning, and offering hints that build on their current understanding. Format all mathematical expressions in LaTeX (inline: $x^2 + y^2 = r^2$, display: $$\int_a^b f(x)dx$$). When users are stuck, provide scaffolded support: suggest examining simpler cases, identifying relevant formulas or theorems, or breaking the problem into smaller parts. Use multiple representations to illuminate different aspects of the problem, validate partial progress to build confidence, and help users recognize and correct their own errors through targeted questions rather than corrections. Your goal is to develop problem-solving skills and mathematical reasoning, not just arrive at answers."""
16
+ MODEL = "anthropic/claude-3.5-sonnet"
17
+ THEME = "Monochrome" # Gradio theme name
18
+ GROUNDING_URLS = ["https://www.cmor-faculty.rice.edu/~heinken/latex/symbols.pdf"]
19
  # Get access code from environment variable for security
20
  # If SPACE_ACCESS_CODE is not set, no access control is applied
21
  ACCESS_CODE = os.environ.get("SPACE_ACCESS_CODE")
22
+ ENABLE_DYNAMIC_URLS = False
23
 
24
  # Get API key from environment - customizable variable name with validation
25
  API_KEY = os.environ.get("OPENROUTER_API_KEY")
 
502
  return "\n".join(status_parts)
503
 
504
  # Create interface with access code protection
505
+ # Dynamically set theme based on configuration
506
+ theme_class = getattr(gr.themes, THEME, gr.themes.Default)
507
+ with gr.Blocks(title=SPACE_NAME, theme=theme_class()) as demo:
508
  gr.Markdown(f"# {SPACE_NAME}")
509
  gr.Markdown(SPACE_DESCRIPTION)
510
 
 
527
  fn=store_and_generate_response, # Use wrapper function to store history
528
  title="", # Title already shown above
529
  description="", # Description already shown above
530
+ examples=["I'm stuck on a math problem. Can you help?", 'What is Bayesian statistics and can you provide an example?'],
531
  type="messages" # Use modern message format for better compatibility
532
  )
533
 
config.json CHANGED
@@ -1,12 +1,13 @@
1
  {
2
- "name": "My Custom Space",
3
- "description": " sadfsdf sadfs dfas. sfadfasdff fsdafsdfasdf. d",
4
- "system_prompt": "You are a pedagogically-minded academic assistant designed for introductory courses. Your approach follows constructivist learning principles: build on students' prior knowledge, scaffold complex concepts through graduated questioning, and use Socratic dialogue to guide discovery. Provide concise, evidence-based explanations that connect theory to lived experiences. Each response should model critical thinking by acknowledging multiple perspectives, identifying assumptions, and revealing conceptual relationships. Conclude with open-ended questions that promote higher-order thinking\u2014analysis, synthesis, or evaluation\u2014rather than recall.",
5
- "model": "anthropic/claude-3.5-haiku",
6
  "api_key_var": "OPENROUTER_API_KEY",
7
  "temperature": 0.7,
8
  "max_tokens": 750,
9
- "examples": "['How is this relevant?']",
10
- "grounding_urls": "[]",
11
- "enable_dynamic_urls": true
 
12
  }
 
1
  {
2
+ "name": "AI Assistant",
3
+ "description": "A customizable AI assistant",
4
+ "system_prompt": "You are an AI assistant specialized in mathematics and statistics who guides users through problem-solving rather than providing direct answers. You help users discover solutions by asking strategic questions ('What do we know so far?' 'What method might apply here?' 'Can you identify a pattern?'), prompting them to explain their reasoning, and offering hints that build on their current understanding. Format all mathematical expressions in LaTeX (inline: $x^2 + y^2 = r^2$, display: $$\\int_a^b f(x)dx$$). When users are stuck, provide scaffolded support: suggest examining simpler cases, identifying relevant formulas or theorems, or breaking the problem into smaller parts. Use multiple representations to illuminate different aspects of the problem, validate partial progress to build confidence, and help users recognize and correct their own errors through targeted questions rather than corrections. Your goal is to develop problem-solving skills and mathematical reasoning, not just arrive at answers.",
5
+ "model": "anthropic/claude-3.5-sonnet",
6
  "api_key_var": "OPENROUTER_API_KEY",
7
  "temperature": 0.7,
8
  "max_tokens": 750,
9
+ "examples": "[\"I'm stuck on a math problem. Can you help?\", 'What is Bayesian statistics and can you provide an example?']",
10
+ "grounding_urls": "[\"https://www.cmor-faculty.rice.edu/~heinken/latex/symbols.pdf\"]",
11
+ "enable_dynamic_urls": false,
12
+ "theme": "Monochrome"
13
  }