Spaces:
Build error
Build error
lfs and style
Browse files- .gitattributes +35 -0
- README.md +12 -110
- style.css +10 -6
.gitattributes
CHANGED
|
@@ -1 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
*.csv filter=lfs diff=lfs merge=lfs -text
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
*.csv filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -1,110 +1,12 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
* **Collapsible Code Display:** The generated code is hidden by default, with an expander to reveal it on demand.
|
| 14 |
-
* **Sample Questions:** Provides a set of sample questions to get started.
|
| 15 |
-
* **Powered by ZEGA.ai:** Includes ZEGA.ai branding.
|
| 16 |
-
|
| 17 |
-
## Getting Started
|
| 18 |
-
|
| 19 |
-
### Prerequisites
|
| 20 |
-
|
| 21 |
-
* Python 3.7+
|
| 22 |
-
* An OpenAI API key
|
| 23 |
-
* pdfkit: you need to have wkhtmltopdf installed on your system.
|
| 24 |
-
* **Windows**: Download and install from [wkhtmltopdf.org](https://wkhtmltopdf.org/downloads.html). Add the `wkhtmltopdf/bin` directory to your system's PATH.
|
| 25 |
-
* **macOS**: `brew install wkhtmltopdf`
|
| 26 |
-
* **Linux (Debian/Ubuntu)**: `sudo apt-get install wkhtmltopdf`
|
| 27 |
-
* **Linux (CentOS/RHEL)**: `sudo yum install wkhtmltopdf`
|
| 28 |
-
|
| 29 |
-
### Installation
|
| 30 |
-
|
| 31 |
-
1. **Clone the repository:**
|
| 32 |
-
|
| 33 |
-
```bash
|
| 34 |
-
git clone <your_repository_url>
|
| 35 |
-
cd <your_repository_directory>
|
| 36 |
-
```
|
| 37 |
-
|
| 38 |
-
2. **Install dependencies:**
|
| 39 |
-
|
| 40 |
-
```bash
|
| 41 |
-
pip install -r requirements.txt
|
| 42 |
-
```
|
| 43 |
-
Create the `requirements.txt` and place this in:
|
| 44 |
-
```
|
| 45 |
-
streamlit
|
| 46 |
-
pandas
|
| 47 |
-
matplotlib
|
| 48 |
-
plotly
|
| 49 |
-
python-dotenv
|
| 50 |
-
langchain
|
| 51 |
-
langchain-experimental
|
| 52 |
-
langchain-openai
|
| 53 |
-
seaborn
|
| 54 |
-
pdfkit
|
| 55 |
-
openai
|
| 56 |
-
```
|
| 57 |
-
|
| 58 |
-
3. **Create a `.env` file:**
|
| 59 |
-
|
| 60 |
-
Create a file named `.env` in the root directory of your project. Add your OpenAI API key to this file:
|
| 61 |
-
|
| 62 |
-
```
|
| 63 |
-
OPENAI_API_KEY=your_openai_api_key_here
|
| 64 |
-
```
|
| 65 |
-
Replace `your_openai_api_key_here` with your actual API key.
|
| 66 |
-
|
| 67 |
-
4. **Place the CSV data file:**
|
| 68 |
-
|
| 69 |
-
Place the `asig_sales_31012025.csv` file in the same directory as your script. If you use a different CSV file, update the `csv_path` variable in the script.
|
| 70 |
-
|
| 71 |
-
5. **Place Zega logo**
|
| 72 |
-
Place the `zega_logo.png` into the folder.
|
| 73 |
-
|
| 74 |
-
### Usage
|
| 75 |
-
|
| 76 |
-
1. **Run the Streamlit app:**
|
| 77 |
-
|
| 78 |
-
```bash
|
| 79 |
-
streamlit run your_script_name.py
|
| 80 |
-
```
|
| 81 |
-
Replace `your_script_name.py` with the name of your Python script.
|
| 82 |
-
|
| 83 |
-
2. **Interact with the app:**
|
| 84 |
-
|
| 85 |
-
* Select a sample question from the sidebar or enter your own question in the text area. Ensure you ask only one question at a time.
|
| 86 |
-
* Click the "Submit" button.
|
| 87 |
-
* The results (data table and plots) will be displayed.
|
| 88 |
-
* Click the "Show the code" expander to view the generated Pandas code.
|
| 89 |
-
* Click the "Download PDF" button to generate a PDF report.
|
| 90 |
-
|
| 91 |
-
## File Structure
|
| 92 |
-
|
| 93 |
-
* **`your_script_name.py`:** The main Streamlit application script.
|
| 94 |
-
* **`.env`:** Contains your OpenAI API key (should *not* be committed to Git).
|
| 95 |
-
* **`requirements.txt`:** Lists the required Python packages.
|
| 96 |
-
* **`asig_sales_31012025.csv`:** The CSV data file (or your custom data file).
|
| 97 |
-
* **`zega_logo.png`:** Zega logo.
|
| 98 |
-
* **`exported_pdfs/`:** A directory (created automatically) where generated PDF reports are saved.
|
| 99 |
-
* **`README.md`:** This file.
|
| 100 |
-
|
| 101 |
-
## Important Notes
|
| 102 |
-
|
| 103 |
-
* **Date Format:** The script is specifically configured to handle dates in the European DD/MM/YYYY format. Ensure your CSV data uses this format. The `parse_dates` argument in `pd.read_csv` is crucial for correct date handling.
|
| 104 |
-
* **OpenAI API Key:** Keep your OpenAI API key secure. Do *not* commit the `.env` file to your Git repository. Add `.env` to your `.gitignore` file.
|
| 105 |
-
* **Error Handling:** The script includes basic error handling (checking for the CSV file), but you might want to add more robust error handling for production use.
|
| 106 |
-
* **wkhtmltopdf:** Ensure `wkhtmltopdf` is correctly installed and accessible in your system's PATH for PDF generation to work.
|
| 107 |
-
* **Prompt Engineering:** The quality of the generated code depends heavily on the prompt used in the `generate_code` function. The provided prompt is highly detailed and includes specific instructions for the agent. You may need to adjust the prompt if you encounter issues or use a different CSV file with different column names or data structures.
|
| 108 |
-
* **One Question:** The app is designed to process one question at a time. Asking multiple questions in a single input may lead to unexpected behavior.
|
| 109 |
-
|
| 110 |
-
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: DataAnalystDemo
|
| 3 |
+
emoji: 👁
|
| 4 |
+
colorFrom: pink
|
| 5 |
+
colorTo: yellow
|
| 6 |
+
sdk: streamlit
|
| 7 |
+
sdk_version: 1.44.1
|
| 8 |
+
app_file: app.py
|
| 9 |
+
pinned: false
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
style.css
CHANGED
|
@@ -29,14 +29,17 @@ h4 {
|
|
| 29 |
|
| 30 |
/* Butoane */
|
| 31 |
|
| 32 |
-
button
|
|
|
|
| 33 |
font-weight: 600 !important;
|
| 34 |
}
|
| 35 |
-
button:hover
|
|
|
|
| 36 |
color: #FA6C03 !important;
|
| 37 |
border-color: #FA6C03 !important;
|
| 38 |
}
|
| 39 |
-
button:focus
|
|
|
|
| 40 |
color: #fff !important;
|
| 41 |
background-color: #FA6C03 !important;
|
| 42 |
}
|
|
@@ -57,7 +60,8 @@ button:focus {
|
|
| 57 |
}
|
| 58 |
|
| 59 |
/* Select */
|
| 60 |
-
.st-ae
|
|
|
|
| 61 |
font-family: inherit !important;
|
| 62 |
}
|
| 63 |
|
|
@@ -67,6 +71,6 @@ button:focus {
|
|
| 67 |
}
|
| 68 |
|
| 69 |
/* Other fonts */
|
| 70 |
-
|
| 71 |
-
|
| 72 |
}
|
|
|
|
| 29 |
|
| 30 |
/* Butoane */
|
| 31 |
|
| 32 |
+
button,
|
| 33 |
+
.myButton {
|
| 34 |
font-weight: 600 !important;
|
| 35 |
}
|
| 36 |
+
button:hover,
|
| 37 |
+
.myButton:hover {
|
| 38 |
color: #FA6C03 !important;
|
| 39 |
border-color: #FA6C03 !important;
|
| 40 |
}
|
| 41 |
+
button:focus,
|
| 42 |
+
.myButton:focus {
|
| 43 |
color: #fff !important;
|
| 44 |
background-color: #FA6C03 !important;
|
| 45 |
}
|
|
|
|
| 60 |
}
|
| 61 |
|
| 62 |
/* Select */
|
| 63 |
+
.st-ae,
|
| 64 |
+
.st-az {
|
| 65 |
font-family: inherit !important;
|
| 66 |
}
|
| 67 |
|
|
|
|
| 71 |
}
|
| 72 |
|
| 73 |
/* Other fonts */
|
| 74 |
+
[class^="st-emotion-cache-"] {
|
| 75 |
+
font-family: 'Inter Tight', Arial, Helvetica, sans-serif !important;
|
| 76 |
}
|