texlab / README.md
syk101's picture
Upload 35 files
f630bbd verified
---
title: TexLab - Professional LaTeX Converter
emoji: 🧮
colorFrom: blue
colorTo: purple
sdk: docker
app_file: app.py
pinned: false
---
# TexLab - Professional LaTeX Converter
TexLab is a cutting-edge platform that transforms handwritten mathematical expressions, scribbles, tables, and camera captures into clean, editable LaTeX code using advanced AI models.
## Features
- **Math Equation Recognition**: Convert printed or handwritten mathematical equations to LaTeX
- **Camera Capture**: Take photos of equations and convert them to LaTeX in real-time
- **Handwritten Notes**: Draw equations directly on our digital canvas and convert them to LaTeX
- **Table Detection**: Automatically detect handwritten tables and convert them to LaTeX tables
- **PDF Processing**: Upload PDFs and extract mathematical content
- **Graph Generation**: Create beautiful mathematical graphs from text commands
- **Subscription Plans**: Flexible pricing options for individual and professional use
## Setup Instructions
1. Install the required packages:
```
pip install -r requirements.txt
```
2. Set up environment variables:
- Rename `.env.example` to `.env`
- Update the values with your own credentials
3. Make sure you have MySQL running and create the database:
```sql
CREATE DATABASE IF NOT EXISTS email_verification;
USE email_verification;
CREATE TABLE IF NOT EXISTS users (
id INT AUTO_INCREMENT PRIMARY KEY,
email VARCHAR(255) NOT NULL UNIQUE,
password VARCHAR(255) NOT NULL,
otp VARCHAR(6),
is_verified TINYINT(1) DEFAULT 0,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
```
4. Update the database credentials in `config.py` if needed:
```python
DB_CONFIG = {
'host': 'localhost',
'user': 'root',
'password': '',
'database': 'email_verification'
}
```
5. Run the application:
```
python app.py
```
6. Visit `http://localhost:5000` in your browser
## Pricing Plans
TexLab offers three subscription plans to meet your needs:
### Basic Plan - $9.99/month
- Convert up to 100 images per month
- Basic math equation recognition
- Email support
- Standard processing speed
### Professional Plan - $24.99/month
- Unlimited image conversions
- Advanced math equation recognition
- Handwritten table detection
- Priority processing speed
- 24/7 customer support
- Early access to new features
### Enterprise Plan - $49.99/month
- Everything in Professional Plan
- Team collaboration tools
- Custom API access
- Dedicated account manager
- SLA guarantee
- On-premise deployment option
## File Structure
- `app.py`: Main application file
- `controller/`: Route handlers for different features
- `models/`: Data models and database interactions
- `templates/`: HTML templates
- `static/`: CSS, JavaScript, and other static files
- `utils/`: Utility functions
- `requirements.txt`: Python dependencies
- `.env`: Environment variables
## Payment Integration
TexLab uses SSLCommerce as its payment gateway. To configure payments:
1. Sign up for an SSLCommerce merchant account
2. Update the SSLCOMMERCE_STORE_ID and SSLCOMMERCE_STORE_PASS in your `.env` file
3. Configure your webhook URLs in the SSLCommerce dashboard
## License
This project is licensed under the MIT License - see the LICENSE file for details.
## Deployment to Hugging Face Spaces
This application is configured for deployment to Hugging Face Spaces using Docker.
### Prerequisites
1. A Hugging Face account
2. A Space created on Hugging Face
### Environment Variables
Set the following environment variables in your Hugging Face Space settings:
- `SECRET_KEY`: A secure secret key for Flask sessions
- `DB_HOST`: Database host
- `DB_USER`: Database user
- `DB_PASSWORD`: Database password
- `DB_NAME`: Database name
- `SSLCOMMERCE_STORE_ID`: Your SSLCommerce store ID (optional)
- `SSLCOMMERCE_STORE_PASS`: Your SSLCommerce store password (optional)
- `GOOGLE_CLIENT_ID`: Your Google OAuth client ID (optional)
- `GOOGLE_CLIENT_SECRET`: Your Google OAuth client secret (optional)
- `SENDGRID_API_KEY`: Your SendGrid API key (optional)
- `MAIL_DEFAULT_SENDER`: Your default email sender address (optional)
### Deployment Steps
1. Create a new Space on Hugging Face
2. Select "Docker" as the SDK
3. Connect your Git repository or upload the files
4. Add the required environment variables in the Space settings
5. The application will automatically build and deploy
### Troubleshooting
If you encounter a `ModuleNotFoundError: No module named 'controller'` error:
1. This has been fixed by installing the package in development mode in the Dockerfile
2. The Dockerfile now uses `pip install -e .` to install the package
3. All controller modules should now be correctly imported
If you still experience import issues, you can run the `test_imports.py` script to verify all modules can be imported correctly.