marketing_chat / project.md
ashkoff's picture
adding file upload and removing followup questions
0fb2c29

A newer version of the Gradio SDK is available: 6.13.0

Upgrade

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
  • uv package manager installed
  • OpenAI API key

Installation

  1. Clone the repository

  2. 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 Windows
    
  3. Install dependencies:

    uv pip install -r requirements.txt
    
  4. Copy .env.example to .env and fill in your API keys:

    cp .env.example .env
    

Running the Application

python app.py

Key Decisions

1. State Management

  • Extended GraphProcessingState to 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 processing
    • update_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

  1. User uploads transcription and IDML template
  2. User can refine content through chat
  3. User submits for final IDML generation
  4. 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 processing
  • simple_idml: For IDML file manipulation
  • langchain: For chat interface and processing
  • gradio: For user interface
  • uv: 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

  1. User uploads transcription and IDML template
  2. System processes initial content
  3. User can chat to refine content
  4. User submits for final processing
  5. System generates updated IDML file