https://github.com/opvious/web-integration-example
Sample code for integrating optimization into a website
https://github.com/opvious/web-integration-example
Last synced: about 2 months ago
JSON representation
Sample code for integrating optimization into a website
- Host: GitHub
- URL: https://github.com/opvious/web-integration-example
- Owner: opvious
- License: apache-2.0
- Created: 2023-10-02T18:28:22.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-10-02T23:12:47.000Z (over 1 year ago)
- Last Synced: 2025-01-23T00:28:18.835Z (3 months ago)
- Language: Jupyter Notebook
- Homepage:
- Size: 114 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Web integration example
This repository shows how to easily integrate optimization into a frontend
application via [Opvious](https://www.opvious.io).## Folder structure
The code in this repository is divided into two folders:
+ [`/app`](/app), containing frontend application code. This example uses
[Next.js](https://nextjs.org/) but many other frameworks would work equally
well.
+ [`/specification`](/specification), containing the model's definition. Here we
use the [Sudoku assistant
model](https://www.opvious.io/notebooks/retro/notebooks/?path=examples/sudoku.ipynb)
as illustration.For most use-cases, we recommend using separate repositories for each of the
above folders when moving beyond the prototyping stage. If you already have an
existing frontend application, simply extend it correspondingly.## Quickstart
1. Create an Opvious API token and store it as `OPVIOUS_TOKEN` environment
variable2. Build the model and register it
```sh
cd specification
poetry install --all-extras
poetry run poe register
```3. Run the frontend application
```sh
cd app
npm i
npm run dev
```That's it - open the link printed by the last command to start optimizing!