> ## Documentation Index
> Fetch the complete documentation index at: https://docs.beam.cloud/llms.txt
> Use this file to discover all available pages before exploring further.

# Running Streamlit Apps

You can easily deploy Streamlit apps on Beam. In this guide, we'll show you how to deploy a simple Streamlit app that visualizes a simple dataset.

<Frame>
  <img src="https://mintcdn.com/slai-beam/vg5aTEbpFmupCYom/img/v2/streamlit.png?fit=max&auto=format&n=vg5aTEbpFmupCYom&q=85&s=9b8b1efc47804bfe6462903c57f94dcb" width="1415" height="814" data-path="img/v2/streamlit.png" />
</Frame>

<Card title="View the Code" icon="github" href="https://github.com/beam-cloud/examples/tree/main/web_servers/streamlit_server">
  See the code for this example on Github.
</Card>

### App Structure

There are two components to deploying a Streamlit app on Beam:

1. An `start_server.py` file with your Beam code. You can view the source code [here](https://github.com/beam-cloud/examples/blob/main/web_servers/streamlit_server/app.py).
2. A `app.py` file that hosts the Streamlit app

Here's what the Beam-specific code looks like:

```python start_server.py theme={null}
from beam import Image, Pod

streamlit_server = Pod(
    image=Image().add_python_packages(["streamlit", "pandas", "altair", "requests"]),
    ports=[8501],  # Default port for streamlit
    cpu=1,
    memory=1024,
    entrypoint=["streamlit", "run", "app.py"],
)

res = streamlit_server.create()

print("✨ Streamlit server hosted at:", res.url)
```

## Deployment

To run the app, you can simply invoke the Python module directly:

```python theme={null}
python start_server.py
```

Running this command will print the URL of the Streamlit app to the console.

```shell theme={null}
=> Creating container
=> Container created successfully ===> pod-15fba0c6-3fe8-408e-a0f8-c99cf166dcc9-97b6207e
=> Invocation details

curl -X GET 'https://15fba0c6-3fe8-408e-a0f8-c99cf166dcc9-8888.app.beam.cloud' \
-H 'Connection: keep-alive' \
-H 'Content-Type: application/json' \
-d '{}'
```

You can enter the URL in your browser to view the Streamlit app!
