Omartificial-Intelligence-Space commited on
Commit
534ee0e
·
verified ·
1 Parent(s): 83721a5

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +94 -1
README.md CHANGED
@@ -10,4 +10,97 @@ pinned: false
10
  license: apache-2.0
11
  ---
12
 
13
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  license: apache-2.0
11
  ---
12
 
13
+ # Chart Generation with LLM Agents
14
+
15
+ A Gradio app that uses LLM agents with reflection pattern to generate and improve data visualizations.
16
+
17
+ ## Features
18
+
19
+ - 🤖 **LLM-Powered Chart Generation**: Uses GPT-4 or Claude to generate matplotlib code
20
+ - 🔄 **Reflection Pattern**: Automatically improves charts by analyzing V1 and generating V2
21
+ - 📊 **Coffee Sales Dataset**: Pre-loaded dataset for demonstration
22
+ - 🎨 **Clean UI**: User-friendly Gradio interface
23
+
24
+ ## How It Works
25
+
26
+ 1. **Generate V1**: LLM creates initial chart code based on your instruction
27
+ 2. **Execute V1**: Code runs and generates first chart
28
+ 3. **Reflect**: LLM analyzes V1 chart image and original code
29
+ 4. **Generate V2**: LLM creates improved code based on feedback
30
+ 5. **Execute V2**: Improved code runs and generates final chart
31
+
32
+ ## Setup
33
+
34
+ ### Local Development
35
+
36
+ 1. Install dependencies:
37
+ ```bash
38
+ pip install -r requirements.txt
39
+ ```
40
+
41
+ 2. Set up environment variables:
42
+ ```bash
43
+ export OPENAI_API_KEY="your-key-here"
44
+ # OR
45
+ export ANTHROPIC_API_KEY="your-key-here"
46
+ ```
47
+
48
+ 3. Run the app:
49
+ ```bash
50
+ python app.py
51
+ ```
52
+
53
+ ### HuggingFace Spaces Deployment
54
+
55
+ 1. Create a new Space on HuggingFace
56
+ 2. Upload all files:
57
+ - `app.py`
58
+ - `utils.py`
59
+ - `coffee_sales_local.csv`
60
+ - `requirements.txt`
61
+ - `README.md` (this file)
62
+
63
+ 3. Add secrets in Space settings:
64
+ - `OPENAI_API_KEY` (if using OpenAI models)
65
+ - `ANTHROPIC_API_KEY` (if using Anthropic models)
66
+
67
+ 4. Set Space SDK to **Gradio**
68
+
69
+ 5. The app will automatically deploy!
70
+
71
+ ## Usage
72
+
73
+ 1. Enter your chart instruction (e.g., "Create a plot comparing Q1 coffee sales in 2024 and 2025")
74
+ 2. Select models for generation (V1) and reflection (V2)
75
+ 3. Click "Generate Charts"
76
+ 4. Compare V1 and V2 charts side by side
77
+ 5. Review the reflection feedback and code
78
+
79
+ ## Dataset Schema
80
+
81
+ The coffee sales dataset includes:
82
+ - `date` (M/D/YY)
83
+ - `time` (HH:MM)
84
+ - `cash_type` (card or cash)
85
+ - `card` (string)
86
+ - `price` (number)
87
+ - `coffee_name` (string)
88
+ - `quarter` (1-4) - auto-derived
89
+ - `month` (1-12) - auto-derived
90
+ - `year` (YYYY) - auto-derived
91
+
92
+ ## Model Recommendations
93
+
94
+ - **Generation (V1)**: Fast models like `gpt-4o-mini` or `gpt-4o`
95
+ - **Reflection (V2)**: Strong reasoning models like `o1-mini`, `o1-preview`, or `claude-3-5-sonnet-20241022`
96
+
97
+ ## Requirements
98
+
99
+ - Python 3.8+
100
+ - OpenAI API key OR Anthropic API key
101
+ - See `requirements.txt` for full dependency list
102
+
103
+ ## License
104
+
105
+ Educational project for demonstrating LLM agents with reflection pattern.
106
+