Spaces:
Sleeping
Sleeping
A newer version of the Gradio SDK is available: 6.13.0
IDML Processing Integration Project
Overview
This project integrates IDML processing capabilities into an existing chat interface. The goal is to allow users to upload transcription files and IDML templates, refine content through chat, and generate updated IDML files.
Setup Instructions
Prerequisites
- Python 3.9 or higher
uvpackage manager installed- OpenAI API key
Installation
Clone the repository
Create and activate virtual environment:
# Create virtual environment uv venv # Activate virtual environment source .venv/bin/activate # On Unix/macOS # or .venv\Scripts\activate # On WindowsInstall dependencies:
uv pip install -r requirements.txtCopy
.env.exampleto.envand fill in your API keys:cp .env.example .env
Running the Application
python app.py
Key Decisions
1. State Management
- Extended
GraphProcessingStateto include file uploads and processing state - Kept the existing message history system for chat interactions
- Added simple file storage in memory for the current session
2. Tool Integration
- Added two main tools:
process_transcription: Handles DOCX file processingupdate_idml: Updates IDML template with processed content
- Kept tools simple and focused on core functionality
- Avoided complex error handling in favor of clear user feedback
3. User Interface
- Added file upload components to the existing chat interface
- Maintained the chat-first approach for content refinement
- Added a simple submit button for final IDML generation
4. Processing Flow
- User uploads transcription and IDML template
- User can refine content through chat
- User submits for final IDML generation
- System processes and returns updated IDML
Implementation Notes
Simplifications
- In-memory file storage instead of persistent storage
- Basic error handling with clear user messages
- Simple JSON structure for metrics
- No complex validation or preprocessing
Future Improvements
- Add persistent storage for files
- Implement more robust error handling
- Add progress indicators for long operations
- Enhance metrics extraction accuracy
- Add preview functionality
Technical Details
Dependencies
docx2txt: For DOCX file processingsimple_idml: For IDML file manipulationlangchain: For chat interface and processinggradio: For user interfaceuv: For Python package management
File Structure
.
βββ app.py # Main application entry
βββ graph.py # Core processing logic
βββ project.md # This documentation
βββ requirements.txt # Project dependencies
βββ setup.sh # Setup script
βββ .env.example # Environment variables template
βββ .env # Environment variables (create from .env.example)
Usage Flow
- User uploads transcription and IDML template
- System processes initial content
- User can chat to refine content
- User submits for final processing
- System generates updated IDML file