milwright commited on
Commit
0322f77
·
verified ·
1 Parent(s): 344f51c

Upload 4 files

Browse files
Files changed (4) hide show
  1. README.md +41 -27
  2. app.py +2 -2
  3. config.json +4 -7
  4. requirements.txt +1 -1
README.md CHANGED
@@ -1,19 +1,19 @@
1
  ---
2
- title: Virgil Reading Guide
3
- emoji: 📚
4
- colorFrom: blue
5
- colorTo: yellow
6
- sdk: gradio
7
- sdk_version: 5.38.0
8
  app_file: app.py
9
- pinned: false
 
 
10
  license: mit
11
- short_description: AI support for college-level reading comprehension
 
 
 
 
12
  ---
13
 
14
- # My Custom Space
15
 
16
- AI reading guide for college-level reading comprehension with a twist: chat always mentions Frankenstein.
17
 
18
  ## Quick Deploy to HuggingFace Spaces
19
 
@@ -30,23 +30,26 @@ AI reading guide for college-level reading comprehension with a twist: chat alwa
30
  2. Upload these files from the zip:
31
  - `app.py`
32
  - `requirements.txt`
 
 
33
  3. Wait for "Building" to complete
34
 
35
- ### Step 3: Add API Key
36
- 1. Go to Settings (gear icon)
37
- 2. Click "Variables and secrets"
38
- 3. Click "New secret"
39
- 4. Name: `OPENROUTER_API_KEY`
40
- 5. Value: Your OpenRouter API key
41
- 6. Click "Add"
42
-
43
 
 
 
 
 
 
 
 
44
 
45
- ### Step 4: Get Your API Key
46
- 1. Go to https://openrouter.ai/keys
47
- 2. Sign up/login if needed
48
- 3. Click "Create Key"
49
- 4. Copy the key (starts with `sk-or-`)
 
 
50
 
51
  ### Step 5: Test Your Space
52
  - Go back to "App" tab
@@ -55,7 +58,18 @@ AI reading guide for college-level reading comprehension with a twist: chat alwa
55
 
56
  ## Configuration
57
 
58
- - **Model**: anthropic/claude-3.5-haiku
59
- - **Temperature**: 0.7
60
- - **Max Tokens**: 750
61
- - **API Key Variable**: OPENROUTER_API_KEY
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
 
 
 
 
 
 
2
  app_file: app.py
3
+ colorFrom: blue
4
+ colorTo: green
5
+ emoji: ✍️
6
  license: mit
7
+ pinned: false
8
+ sdk: gradio
9
+ sdk_version: 5.39.0
10
+ short_description: A sentence level writing assistant
11
+ title: Writing Aid
12
  ---
13
 
14
+ # Writing Aid
15
 
16
+ A sentence level writing assistant
17
 
18
  ## Quick Deploy to HuggingFace Spaces
19
 
 
30
  2. Upload these files from the zip:
31
  - `app.py`
32
  - `requirements.txt`
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 5: Test Your Space
55
  - Go back to "App" tab
 
58
 
59
  ## Configuration
60
 
61
+ - **Model**: anthropic/claude-3.5-sonnet
62
+ - **API Key Variable**: API_KEY
63
+ - **Access Code Variable**: ACCESS_CODE
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
+ Changes save automatically and the Space restarts to apply them.
app.py CHANGED
@@ -10,8 +10,8 @@ import urllib.parse
10
 
11
 
12
  # Configuration
13
- SPACE_NAME = 'AI Assistant'
14
- SPACE_DESCRIPTION = 'A customizable AI assistant'
15
 
16
  # Default configuration values (used only if config.json is missing)
17
  DEFAULT_CONFIG = {
 
10
 
11
 
12
  # Configuration
13
+ SPACE_NAME = 'Writing Aid'
14
+ SPACE_DESCRIPTION = 'A sentence level writing assistant'
15
 
16
  # Default configuration values (used only if config.json is missing)
17
  DEFAULT_CONFIG = {
config.json CHANGED
@@ -1,7 +1,7 @@
1
  {
2
- "name": "AI Assistant",
3
- "description": "A customizable AI assistant",
4
- "system_prompt": "You are a sentence-level writing and composition assistant specializing in micro-writing pedagogy. Work with student submissions of single sentences to one paragraph maximum, providing focused feedback on sentence structure, word choice, clarity, and flow. Guide students through incremental, single-paragraph improvements rather than wholesale rewrites and emphasize the building blocks of process-based writing and the rhetorical grammar of subject-verb relationships, citational practice, transitions and signposting, prosody and rhythm. Focus on sentence structure clarity and variety, precise word choice, transitional logic between ideas, concrete specificity over vague generalizations and genre-specific tone and voice. Frequently offer 1-2 specific, actionable suggestions per submission, celebrate what's working before suggesting improvements. Briefly unpack the **why** behind suggestions and ask at least one simple follow-up question to facilitate the next cycle. Maintain high fidelity to existing versions as a rule of thumb, and expect to complete the response in less than 400 tokens. Always mention Frankenstein.",
5
  "model": "anthropic/claude-3.5-sonnet",
6
  "api_key_var": "API_KEY",
7
  "temperature": 0.5,
@@ -17,8 +17,5 @@
17
  "https://en.wikipedia.org/wiki/Essay"
18
  ],
19
  "enable_dynamic_urls": true,
20
- "theme": "Ocean",
21
- "locked": false,
22
- "last_modified": "2025-08-01T04:21:43.145427",
23
- "last_modified_by": "faculty"
24
  }
 
1
  {
2
+ "name": "Writing Aid",
3
+ "description": "A sentence level writing assistant",
4
+ "system_prompt": "You are a sentence-level writing and composition assistant specializing in micro-writing pedagogy. Work with student submissions of single sentences to one paragraph maximum, providing focused feedback on sentence structure, word choice, clarity, and flow. Guide students through incremental, single-paragraph improvements rather than wholesale rewrites and emphasize the building blocks of process-based writing and the rhetorical grammar of subject-verb relationships, citational practice, transitions and signposting, prosody and rhythm. Focus on sentence structure clarity and variety, precise word choice, transitional logic between ideas, concrete specificity over vague generalizations and genre-specific tone and voice. Frequently offer 1-2 specific, actionable suggestions per submission, celebrate what's working before suggesting improvements. Briefly unpack the **why** behind suggestions and ask at least one simple follow-up question to facilitate the next cycle. Maintain high fidelity to existing versions as a rule of thumb, and expect to complete the response in less than 400 tokens.",
5
  "model": "anthropic/claude-3.5-sonnet",
6
  "api_key_var": "API_KEY",
7
  "temperature": 0.5,
 
17
  "https://en.wikipedia.org/wiki/Essay"
18
  ],
19
  "enable_dynamic_urls": true,
20
+ "theme": "Ocean"
 
 
 
21
  }
requirements.txt CHANGED
@@ -1,4 +1,4 @@
1
- gradio>=5.38.0
2
  requests>=2.32.3
3
  beautifulsoup4>=4.12.3
4
  python-dotenv>=1.0.0
 
1
+ gradio>=5.39.0
2
  requests>=2.32.3
3
  beautifulsoup4>=4.12.3
4
  python-dotenv>=1.0.0