Deploy LlamaIndex Apps | Streamlit on the Port the Platform Assigns
Streamlit apps that bind the assigned port. The stock one never does.
chat-with-pdf
Just deployed
summarize-url
Just deployed
LlamaIndex apps on Streamlit
Two small LlamaIndex apps - chat with a PDF, and summarize a URL - deployed as separate services.
What this fixes
The existing LlamaIndex Apps template reports 0% health: no deployment of it succeeds. The cause is one line, and it is in the template rather than the code.
Its start command is a bare streamlit run streamlit_app.py. Streamlit then
listens on its own default port, which is not the port the platform assigns and
routes to. The template does set a PORT variable - but Streamlit does not read
PORT; it wants --server.port or STREAMLIT_SERVER_PORT, so that variable
changes nothing.
Here the start command passes it explicitly:
streamlit run streamlit_app.py --server.port $PORT --server.address 0.0.0.0 --server.headless true
--server.headless true matters in a container too: without it Streamlit tries
to open a browser and prompts for an email on first run.
Verified
Both services deployed and answered /_stcore/health with ok, and their logs
show a clean start with no import errors. The apps themselves need an OpenAI API
key, which you enter in the app's own sidebar - that part is not exercised here,
and nothing in this template asks you for a key up front.
The apps
- chat-with-pdf - upload a PDF, ask questions about it
- summarize-url - give it a link, get a summary
Both are unmodified from the upstream project by alphasec, MIT licensed: https://github.com/alphasecio/llama-index
The only change is the start command.
Template Content
chat-with-pdf
ak40u/llama-index-railwaysummarize-url
ak40u/llama-index-railway