๐งฎ Qwen Math Assistant
A powerful AI-powered mathematical problem solver built with Qwen language model and deployed on Hugging Face Spaces.
๐ Features
- Step-by-step Solutions: Get detailed explanations for mathematical problems
- Wide Range of Topics: Algebra, calculus, geometry, trigonometry, and more
- Interactive Interface: Clean and intuitive Gradio-powered chat interface
- Real-time Processing: Fast response times with optimized model loading
- Example Problems: Quick-start with pre-loaded example questions
๐ฏ Supported Math Topics
- โ Algebra: Linear equations, quadratic equations, polynomial operations
- โ Calculus: Derivatives, integrals, limits
- โ Geometry: Area, volume, perimeter calculations
- โ Trigonometry: Sin, cos, tan functions and identities
- โ Statistics: Basic statistical calculations
- โ Number Theory: Prime numbers, factorization
๐ ๏ธ How to Use
- Load the Model: Click the "๐ Load Model" button to initialize the AI assistant
- Ask Questions: Type your math problem in the text box
- Get Solutions: Receive step-by-step explanations and answers
- Try Examples: Click on example problems to get started quickly
Example Queries:
- "Solve: 2x + 5 = 15"
- "What is the derivative of xยฒ + 3x - 2?"
- "Factor: xยฒ - 9"
- "Calculate the area of a circle with radius 5"
๐๏ธ Technical Details
Model Architecture
- Base Model: Qwen2.5-0.5B (optimized for Hugging Face Spaces)
- Framework: Transformers, PyTorch
- Interface: Gradio
- Deployment: Hugging Face Spaces
Performance Optimizations
- Efficient memory usage with
low_cpu_mem_usage=True - Dynamic device mapping for GPU/CPU compatibility
- Optimized tokenization with proper padding handling
- Response caching for better performance
๐ Requirements
- Python 3.8+
- PyTorch 2.0+
- Transformers 4.35+
- Gradio 4.0+
- PEFT 0.6+
๐ Deployment
Local Setup
git clone <your-repo>
cd qwen-math-assistant
pip install -r requirements.txt
python app.py
Hugging Face Spaces
- Create a new Space on Hugging Face
- Upload
app.pyandrequirements.txt - Set the SDK to "gradio"
- The Space will automatically build and deploy
๐ง Configuration
The application includes several configurable parameters:
- Max Response Length: Adjustable slider (50-500 tokens)
- Temperature: Set to 0.7 for balanced creativity/accuracy
- Top-p Sampling: 0.9 for diverse but relevant responses
๐ License
This project is open source and available under the MIT License.
๐ค Contributing
Contributions are welcome! Please feel free to submit issues or pull requests.
๐ Support
For questions or support, please open an issue in the repository or contact the maintainers.
Note: This application uses the Qwen language model. Please ensure you comply with the model's usage terms and conditions.
- Downloads last month
- -