File size: 1,714 Bytes
a349175
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# Running CS-Tutor Locally

While cs-tutor is hosted on a Huggingface space, it's easy to run locally on your development machine.

## Pre-requisites

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`.

## Clone the repo

Create a new directory and git clone the repo. From the command line, use `git clone https://huggingface.co/spaces/simonguest/cs-tutor`

## Use pip to install the required Python libraries

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).

## Install Gradio

Run `pip install gradio` to install the main Gradio library.

## Run the application

To run the application, use the following command:

`OPENAI_API_KEY=[key] gradio app.py`

Replace key with an OpenAI key from your organization. If everything is successful, you should see this message:

`Running on local URL:  http://127.0.0.1:7861`

Open a Web browser to this URL to access the application.

## Adding more levels

To add a new level, create a new level number folder in the levels folder. Within this new level folder, create three files:

- **metadata.json**: a JSON file pointing to the instructions and starter code. See the other levels for the exact format.
- **instructions.md**: a markdown file with instructions for the AI tutor
- **sample_code.py**: a Python file with the starter code for the student

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)