A Streamlit application that converts PDF documents and images to Markdown format using Mistral OCR API.
- Clone the repository:
git clone <your-repository-url>
cd <repository-name>- Install dependencies:
pip install -r requirements.txt- Create a
.envfile in the root directory with your Mistral API key:
MISTRAL_API_KEY=your_api_key_here- Run the application:
streamlit run app.py-
Push your code to GitHub (ensure
.envis not included) -
Go to Streamlit Cloud
-
Click on "New app" and select your repository
-
Configure the deployment:
- Set the Python version (3.9 or higher recommended)
- Set the main file path as
app.py - In the "Advanced settings" section, add your secrets:
- Key:
MISTRAL_API_KEY - Value: Your actual Mistral API key
- Key:
-
Click "Deploy"
Your app will be deployed and accessible via a public URL.
To update or manage secrets after deployment:
- Go to your app settings
- Click on "Secrets"
- Add or modify the secrets in TOML format:
MISTRAL_API_KEY = "your_api_key_here"- Convert PDF documents to Markdown
- Convert images (PNG, JPG, JPEG, TIFF, BMP) to Markdown
- View both rendered and raw Markdown output
- Download converted Markdown files
The application requires the following environment variable:
MISTRAL_API_KEY: Your Mistral API key for OCR services
You can obtain a Mistral API key from Mistral AI's website.
- Never commit your
.envfile to version control - Keep your API key secure and don't share it publicly
- The
.envfile is included in.gitignoreto prevent accidental commits - When deploying, always use Streamlit Cloud's secrets management
- Monitor your API usage and set up appropriate rate limiting if needed