Repository navigation
Add a Streamlit UI and Docker Compose for text analysis and OCR - #3
Merged
Merged
Conversation
…d OCR. One FastAPI app now serves Azure Language sentiment and key phrases plus Tesseract OCR. Credentials come from the environment, and a missing key returns a clear 503 instead of calling Azure. The hardcoded subscription key and the extra FastAPI entry points are gone. Co-authored-by: Ovo Okpubuluku <ovo@live.ca>
The new Demo section walks through the Compose stack: the Streamlit page, OCR on the sample image, the configuration message, and the API docs. Co-authored-by: Ovo Okpubuluku <ovo@live.ca>
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.
Summary
The repo had FastAPI routes and no page to use them, plus two API entry points and a hardcoded Azure key. This adds a local workbench you can run with Docker, and it refuses to call Azure until real credentials are in the environment.
app/main.py) for both Azure AI Language and Tesseract. Rootmain.pystill exportsapp, sogunicorn -k uvicorn.workers.UvicornWorker main:appkeeps working.Dockerfile,Dockerfile.frontend, anddocker-compose.yml. Copy.env.exampleto.env. That file is gitignored. Empty values are fine.fastapi-app/main.py,fastapi-app/main2.py, and the rootutils.py. The sample image is nowsamples/ocr-sample.png.main.pyare deleted. Rotate them. They are still in git history. Steps are inPRODUCTIONIZING.md.Demo
About one minute of the Compose stack with Azure keys left empty: the Streamlit page, OCR on
samples/ocr-sample.png, the configuration message after Analyze text, then the Swagger docs. The same steps are written up in the README under Demo.streamlit_ocr_missing_azure_keys_and_api_docs.mp4
How to run
Tests
26 pytest tests, including a mocked Azure success path, the 503 when keys are absent, OCR on the sample image, and Streamlit AppTest.
docker compose up --buildwas run here: health checks passed, analyze returned 503 with the setup message, OCR read the sample PNG, and the UI in Chromium submitted both a review and that image through the API container.To show artifacts inline, enable in settings.