Spaces:
Sleeping
Sleeping
Commit
·
a349175
1
Parent(s):
ab4154f
Added local dev machine instructions
Browse files
SETUP.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Running CS-Tutor Locally
|
| 2 |
+
|
| 3 |
+
While cs-tutor is hosted on a Huggingface space, it's easy to run locally on your development machine.
|
| 4 |
+
|
| 5 |
+
## Pre-requisites
|
| 6 |
+
|
| 7 |
+
You'll need Python installed, preferably 3.10 or higher. Run `python --version` to check. On systems where you have both Python 2 and 3 installed, you may need to run `python3 --version`.
|
| 8 |
+
|
| 9 |
+
## Clone the repo
|
| 10 |
+
|
| 11 |
+
Create a new directory and git clone the repo. From the command line, use `git clone https://huggingface.co/spaces/simonguest/cs-tutor`
|
| 12 |
+
|
| 13 |
+
## Use pip to install the required Python libraries
|
| 14 |
+
|
| 15 |
+
From within the cloned cs-tutor directory, run `pip install -r requirements.txt'` (Note: Depending on your system, you may need to run `pip3` instead).
|
| 16 |
+
|
| 17 |
+
## Install Gradio
|
| 18 |
+
|
| 19 |
+
Run `pip install gradio` to install the main Gradio library.
|
| 20 |
+
|
| 21 |
+
## Run the application
|
| 22 |
+
|
| 23 |
+
To run the application, use the following command:
|
| 24 |
+
|
| 25 |
+
`OPENAI_API_KEY=[key] gradio app.py`
|
| 26 |
+
|
| 27 |
+
Replace key with an OpenAI key from your organization. If everything is successful, you should see this message:
|
| 28 |
+
|
| 29 |
+
`Running on local URL: http://127.0.0.1:7861`
|
| 30 |
+
|
| 31 |
+
Open a Web browser to this URL to access the application.
|
| 32 |
+
|
| 33 |
+
## Adding more levels
|
| 34 |
+
|
| 35 |
+
To add a new level, create a new level number folder in the levels folder. Within this new level folder, create three files:
|
| 36 |
+
|
| 37 |
+
- **metadata.json**: a JSON file pointing to the instructions and starter code. See the other levels for the exact format.
|
| 38 |
+
- **instructions.md**: a markdown file with instructions for the AI tutor
|
| 39 |
+
- **sample_code.py**: a Python file with the starter code for the student
|
| 40 |
+
|
| 41 |
+
To run the level, browser to `http://127.0.0.1:7861?level=[level]` - replace [level] with the title of the level folder that you created (e.g., http://127.0.0.1:7861?level=4)
|