ramonpzg / nbswitch

A tool for changing the use case of a lesson inside a jupyter notebook.
https://nbswitch.fly.dev/
Apache License 2.0
0 stars 0 forks source link

NbSwitch

NbSwitch let's you bring a notebook with educational content, describe a new use case, and change the original one to that using Claude Sonnet 3.5!

alt text

There are thousands of incredible educational notebooks out there that could be shown some love, so, what if that meant that, in the case of data-related topics, we could change the use case of any given notebook to a completely new one? That's what NbSwitch is for. :sunglasses:

As of now, the app works in the following way:

  1. Select your notebook and write a prompt (there is no order for this at the moment). Press the wide green button.
  2. Claude will go through the notebook and, based on a template prompt and your written one, it will evaluate which cells need to change and which don't and then return a list with the index of each of the cells that will need to be changed.
  3. The second pass through Claude includes:
    1. A slightly different prompt template
    2. your prompt again
    3. the list of cells that need to be changed
  4. Then the endpoint returns HTML back to the front-end with both the new and the original notebook
  5. Scroll down for a button to download your .ipynb file.

The app can be found live here.

Limitations

alt text

This project was created as part of Anthropic's June 2024 Hackathon and it was build using their Claude Sonnet 3.5 model.

While I made this app to participate in the Hackathon, I see a lot of value in this project and will continue to polish and host it for free for as long as I can. The code will remain open-source as well. :)

Note: The code in this repo is fresh out of the oven, meaning, its ugliness might offend people, its lack of tests might give some a cardiac arrest, and its lack of React or something similar in the front-end might... (I'll leave that last one to you).

Set Up

Create an environment.

python -m venv venv

or

mamba create -n hackathon python=3.11

Activate your environment.

source venv/bin/activate

or

mamba activate hackathon

Install the dependencies.

pip install -r requirements.txt

Run the app.

uvicorn main:app --reload

Tech Stack

Roadmap