NFT pricing model.
- Install Python and start a virtual environment
- Install required packages
pip install -r requirement.txt
- Run
data.pyto get data for model - calls from opensea api, process data and saves intodata.csv
python3 data.py
- Run
predict.pyto get predictions - saves intopreds.csv
python3 predict.py
- Alternatively run notebooks in colab
- Get
data.csvfrom repository to load into colab notebooksPenguins_data_&_model.ipynb & Penguins_analysis.ipynb
- NFT pricing model
- app.py: Flask API/web application
- data.py: function to get and process the data
- fit.py: initiates a new model, trains the model, and saves as joblib model
- predict.py: takes in data and returns predictions
- requirements.txt: list of packages that the app will import
- lib
- data: directory that contains the data and prediction files
- models: directory that contains the pickled model files
- Run the Flask API locally for testing. Go to directory with
app.py.
python app.py- In a new terminal window, use HTTPie to make a GET request at the URL of the API.
http http://127.0.0.1:5000/api nft_id==1 - Example of successful output.
HTTP/1.0 200 OK
Content-Length: 203
Content-Type: application/json
Date: Thu, 19 Aug 2021 05:48:52 GMT
Server: Werkzeug/1.0.1 Python/3.7.7
{
"image_link": "https://api.pudgypenguins.io/penguin/image/1",
"nft_id": 1,
"opensea-link": "https://opensea.io/assets/0xbd3531da5cf5857e7cfaa92426877b022e612cf8/1",
"prediction": 3.4
}