mirror of
https://github.com/run-llama/invoice-extraction-vibe-coding.git
synced 2026-06-30 21:27:54 -04:00
Jerry/refactor (#2)
* cr * cr * cr * cr --------- Co-authored-by: Jerry Liu <jerryjliu98@gmail.com>
This commit is contained in:
@@ -1,7 +1,15 @@
|
||||
# Invoice Processing App - Vibe Coding Example
|
||||
# Invoice Processing App - Vibe Coding a Web App
|
||||
|
||||
This repository demonstrates how to "vibe code" a full-stack invoice processing application using Cursor/Claude Code from a simple starting file. This showcases building a complete Streamlit application with LlamaCloud's document extraction capabilities.
|
||||
|
||||
## 🎯 What This Repository Is Capable Of
|
||||
|
||||
This repository provides a complete end-to-end solution for building intelligent document processing applications:
|
||||
|
||||
1. **Vibe Coding Templates to Create Full Web Applications**: Provides comprehensive prompts that can be used alongside coding assistants like cursor to one-shot transform simple scripts into production web applications
|
||||
2. **LlamaCloud Integration**: Automatically creates and configures LlamaExtract extraction agents using predefined Pydantic schemas for structured data extraction
|
||||
7. **Sample scripts**: Sample scripts that can be used as context for coding assistants while generating new streamlit apps!
|
||||
|
||||
## 🚀 Quick Start - Vibe Coding Your Own App
|
||||
|
||||
This repository demonstrates **vibe coding** - rapidly building applications through iterative AI-assisted development. The goal is to transform a simple script into a full-featured application using Cursor/Claude Code.
|
||||
@@ -120,7 +128,7 @@ Try the full prompt first - you might be surprised how much gets built in a sing
|
||||
## 🔧 Features
|
||||
|
||||
### Current Application (`app.py`)
|
||||
- 📄 **Multi-format Support**: PDF, Word documents (.docx), images (JPG, PNG, etc.), and other common document formats
|
||||
- 📄 **Multi-format Support**: JPG, JPEG, PNG, BMP, TIFF
|
||||
- 🎨 **Professional UI**: Custom CSS styling and responsive design
|
||||
- 📊 **Data Visualization**: Structured invoice data display
|
||||
- 📈 **Analytics**: Processing metrics and status tracking
|
||||
@@ -139,7 +147,7 @@ See `sample_data/sample_schema.py` for the complete Pydantic model definitions.
|
||||
|
||||
## 📝 Usage
|
||||
|
||||
1. **Upload Invoice**: Drag and drop or select an invoice document (PDF, Word, or image)
|
||||
1. **Upload Invoice**: Drag and drop or select an invoice image
|
||||
2. **Extract Data**: Click the extraction button to process with LlamaCloud
|
||||
3. **View Results**: See structured data in formatted tables and JSON
|
||||
4. **Track History**: View processed invoices in the history tab
|
||||
@@ -158,8 +166,8 @@ agent_name = "your-agent-name"
|
||||
### Common Issues
|
||||
- **API Key**: Ensure your LlamaCloud API key is valid and in `.env`
|
||||
- **Dependencies**: Run `pip install -r requirements.txt`
|
||||
- **File Formats**: Supports PDF, Word documents, images, and other common document formats
|
||||
- **File Size**: Keep documents under 10MB for best performance
|
||||
- **File Formats**: Only image formats are supported
|
||||
- **File Size**: Keep images under 10MB for best performance
|
||||
|
||||
## 🤝 Contributing
|
||||
|
||||
|
||||
@@ -20,11 +20,11 @@ PROJECT_ID = os.getenv("LLAMA_CLOUD_PROJECT_ID", "your-project-id-here")
|
||||
ORGANIZATION_ID = os.getenv("LLAMA_CLOUD_ORGANIZATION_ID", "your-organization-id-here")
|
||||
AGENT_NAME = os.getenv("LLAMA_CLOUD_AGENT_NAME", "your-agent-name-here")
|
||||
|
||||
# Sample document path
|
||||
SAMPLE_DOCUMENT = "sample_data/batch1-0274.jpg"
|
||||
# Sample image path
|
||||
SAMPLE_IMAGE = "sample_data/batch1-0274.jpg"
|
||||
|
||||
def main():
|
||||
"""Run invoice extraction on sample document."""
|
||||
"""Run invoice extraction on sample image."""
|
||||
|
||||
# Validate configuration
|
||||
if PROJECT_ID == "your-project-id-here" or ORGANIZATION_ID == "your-organization-id-here":
|
||||
@@ -50,9 +50,9 @@ def main():
|
||||
agent = extract.get_agent(name=AGENT_NAME)
|
||||
print(f"✅ Successfully connected to agent: {AGENT_NAME}")
|
||||
|
||||
# Run extraction on sample document
|
||||
print(f"📄 Processing sample invoice: {SAMPLE_DOCUMENT}")
|
||||
result = agent.extract(SAMPLE_DOCUMENT)
|
||||
# Run extraction on sample image
|
||||
print(f"📄 Processing sample invoice: {SAMPLE_IMAGE}")
|
||||
result = agent.extract(SAMPLE_IMAGE)
|
||||
|
||||
# Display results
|
||||
print("✅ Extraction completed successfully!")
|
||||
@@ -73,8 +73,8 @@ def main():
|
||||
print(f"❌ API Error: {e}")
|
||||
print("Check your API key and agent configuration.")
|
||||
except FileNotFoundError:
|
||||
print(f"❌ Sample document not found: {SAMPLE_DOCUMENT}")
|
||||
print("Make sure the sample_data directory exists with the sample document.")
|
||||
print(f"❌ Sample image not found: {SAMPLE_IMAGE}")
|
||||
print("Make sure the sample_data directory exists with the sample image.")
|
||||
except Exception as e:
|
||||
print(f"❌ Unexpected error: {e}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user