Spaces:
Sleeping
Sleeping
File size: 1,964 Bytes
4e328cf 542b1cf 4e328cf 542b1cf 4e328cf 542b1cf | 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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | ---
title: Book Analytics Space
emoji: π
colorFrom: blue
colorTo: gray
sdk: gradio
sdk_version: 5.22.0
app_file: app.py
pinned: false
---
# Book Analytics Space
This Hugging Face Space runs a Jupyter notebook on two CSV datasets and then exposes the outputs in a Gradio interface.
## Files included
- `app.py` β the Gradio application
- `style.css` β a clean style file with no background images
- `requirements.txt` β Python dependencies
- `2a_Python_Analysis_Constance_Gonnelle.ipynb` β the analysis notebook
- `books_data.csv` β sales dataset
- `synthetic_book_reviews.csv` β reviews dataset
## How it works
1. The app copies `books_data.csv` to `synthetic_sales_data.csv` because the notebook expects that filename.
2. The app executes the notebook with `papermill`.
3. The notebook writes figures and tables to `artifacts/py/figures` and `artifacts/py/tables`.
4. The Dashboard tab reads those outputs and displays KPIs, charts, images, and tables.
## Expected notebook exports
The current app is ready for these notebook outputs:
- `artifacts/py/figures/sales_trends_sampled_titles.png`
- `artifacts/py/figures/sentiment_distribution_sampled_titles.png`
- `artifacts/py/figures/arima_forecasts_sampled_titles.png`
- `artifacts/py/figures/kpis.json`
- `artifacts/py/tables/df_dashboard.csv`
- `artifacts/py/tables/sentiment_counts_sampled.csv`
- `artifacts/py/tables/top_titles_by_units_sold.csv`
## Deploy on Hugging Face Spaces
1. Create a new **Gradio** Space.
2. Upload all files from this package.
3. Wait for the build to finish.
4. Open the Space and click **Run notebook**.
5. Open **Dashboard** to inspect the generated outputs.
## Notes
- The notebook contains a `!pip install ...` cell. It is better to keep dependencies in `requirements.txt`, but the app can still run with the current notebook.
- If you change the notebook filename, update the `NB_ANALYSIS` environment variable or rename the file in the repository.
|