Add web interface for localhost usage#3
Open
FreddieFF2006 wants to merge 10 commits intoALucek:mainfrom
Open
Conversation
Added a FastAPI-based web application that provides a browser interface for converting PowerPoint presentations to descriptions. This makes the tool more accessible and easier to use for quick conversions. Changes: - Created webapp.py with FastAPI endpoints and HTML interface - Added Dockerfile.webapp for containerized deployment - Updated docker-compose.yml to include ppt2desc-web service - Added FastAPI, uvicorn, and python-multipart dependencies - Created LOCALHOST_GUIDE.md with detailed setup instructions - Updated README.md to highlight web interface option - Added start_web.sh script for easy launching The web interface supports all AI providers (Gemini, OpenAI, Anthropic, Azure, AWS) and provides a clean UI for uploading files, configuring settings, and viewing results directly in the browser. Access at http://localhost:8000 after running docker compose up.
Fixed several issues preventing the web container from starting: - Added src/__init__.py for proper Python package structure - Updated Dockerfile.webapp to use uv sync without --frozen flag - Set PYTHONPATH environment variable in container - Changed CMD to use 'python -m uvicorn' for better module loading - Enhanced start_web.sh with --rebuild flag for easy container rebuilding - Improved start_web.sh with better error messages and status checks The web application should now start correctly in Docker. To rebuild and start: ./start_web.sh --rebuild
Changed imports in webapp.py from absolute to relative imports using dot notation. This fixes the ModuleNotFoundError when running the webapp as a module (src.webapp:app) in the Docker container. Imports changed from: from llm.google_unified import ... To: from .llm.google_unified import ... This ensures the module can be properly imported when running as src.webapp:app via uvicorn.
Changed imports in processor.py from absolute to relative imports to fix ModuleNotFoundError when webapp imports processor module. This is required because webapp.py is imported as a module (src.webapp:app) and all files it imports must use relative imports within the src package.
Added try/except blocks to support both import styles in processor.py and webapp.py. This allows the code to work in both scenarios: 1. When imported as a module (e.g., src.webapp:app in Docker) - Uses relative imports (.llm, .processor, etc.) 2. When run as a script (e.g., uv run src/main.py) - Falls back to absolute imports (llm, processor, etc.) This ensures compatibility with both the web application (running as a module) and the CLI (running as a script).
Explicitly convert all response data to strings to prevent 'Object of type PosixPath is not JSON serializable' errors. Added str() conversions for: - deck filename - model name - slide content This ensures the JSONResponse can properly serialize all data.
Added a green 'Download JSON' button that appears after conversion completes. The button allows users to download the results as a properly formatted JSON file. Features: - Downloads with filename matching the presentation name - Nicely formatted JSON with 2-space indentation - Green button styling to distinguish from convert button - Downloads directly to user's default download folder The JSON file now persists on the user's machine instead of being deleted with the temporary files.
The processor returns image paths, not slide descriptions. The actual AI-generated descriptions are written to a JSON file on disk. Fixed by: - Reading the generated JSON file after processing completes - Returning the actual slide content from the JSON instead of image paths - Added proper error handling for missing or invalid JSON files This fixes the issue where the web interface was showing image file paths instead of the actual AI-generated slide descriptions.
Updated all references to use port 5001 instead of 8000: - docker-compose.yml: Map external port 5001 to internal port 8000 - start_web.sh: Update messages and local uvicorn command to use 5001 - README.md: Update web interface URL - LOCALHOST_GUIDE.md: Update all port references and examples The service is now accessible at http://localhost:5001
Removed the default value 'http://libreoffice-converter:2002' which only works inside Docker. Now the field is empty by default with a placeholder showing 'http://localhost:2002' for local development. Updated help text to be clearer about using the Docker converter.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added a FastAPI-based web application that provides a browser interface for converting PowerPoint presentations to descriptions. This makes the tool more accessible and easier to use for quick conversions.
Changes:
The web interface supports all AI providers (Gemini, OpenAI, Anthropic, Azure, AWS) and provides a clean UI for uploading files, configuring settings, and viewing results directly in the browser.
Access at http://localhost:8000 after running docker compose up.