Skip to content

Add a Streamlit UI and Docker Compose for text analysis and OCR - #3

Merged
ovokpus merged 2 commits into
mainfrom
cursor/streamlit-ui-docker-ef1f
Oct 29, 2026
Merged

ovokpus merged 2 commits into
mainfrom
cursor/streamlit-ui-docker-ef1f

Conversation

@ovokpus

@ovokpus ovokpus commented Oct 29, 2026 •

Copy link
Copy Markdown
Owner

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.

  • Streamlit UI on port 8501 for sentiment, key phrases, and image OCR. It talks only to the API.
  • One FastAPI app (app/main.py) for both Azure AI Language and Tesseract. Root main.py still exports app, so gunicorn -k uvicorn.workers.UvicornWorker main:app keeps working.
  • Dockerfile, Dockerfile.frontend, and docker-compose.yml. Copy .env.example to .env. That file is gitignored. Empty values are fine.
  • Missing or placeholder Azure settings return HTTP 503 with the variable names to set. The process still starts, and OCR does not need those keys.
  • Removed fastapi-app/main.py, fastapi-app/main2.py, and the root utils.py. The sample image is now samples/ocr-sample.png.
  • The subscription key and Application Insights instrumentation key that used to live in main.py are deleted. Rotate them. They are still in git history. Steps are in PRODUCTIONIZING.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

cp .env.example .env
docker compose up --build

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 --build was 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.

Open in Web Open in Cursor 

cursoragent and others added 2 commits October 29, 2026 18:05
…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>
@ovokpus
ovokpus merged commit 7c99df8 into main Oct 29, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants