Spaces:
Sleeping
A newer version of the Gradio SDK is available:
6.2.0
π Quick Start Guide
Get the Multilingual QA System up and running in 5 minutes!
β‘ Fast Track
# 1. Clone and enter directory
git clone https://github.com/Praanshull/multilingual-qa-system.git
cd multilingual-qa-system
# 2. Install dependencies
pip install -r requirements.txt
# 3. Run setup script (first time only)
python setup_project.py
# 4. Launch application
python app.py
Then open http://localhost:7860 in your browser!
π Detailed Steps
Step 1: Prerequisites
Make sure you have:
- β Python 3.8 or higher
- β pip (Python package manager)
- β Git
- β (Optional) CUDA-capable GPU
Check your Python version:
python --version
Step 2: Clone Repository
git clone https://github.com/Praanshull/multilingual-qa-system.git
cd multilingual-qa-system
Step 3: Create Virtual Environment (Recommended)
Windows:
python -m venv venv
venv\Scripts\activate
Mac/Linux:
python -m venv venv
source venv/bin/activate
Step 4: Install Dependencies
pip install -r requirements.txt
This will install:
- PyTorch
- Transformers
- Gradio
- PEFT
- And other required packages
Estimated time: 2-5 minutes
Step 5: Setup Project Structure
python setup_project.py
This script will:
- Create necessary directories
- Move model files to correct locations
- Create configuration files
- Verify everything is set up correctly
Note: If you haven't downloaded the model yet, you'll need to:
- Download from Google Drive (if shared)
- Or the model will be downloaded automatically on first run
Step 6: Test the Model (Optional)
python test_model.py
This runs quick tests to verify everything works.
Step 7: Launch the Application
python app.py
You should see: ```
π LAUNCHING APPLICATION
β Application launched successfully! π± Access the interface at: http://localhost:7860
### Step 8: Open in Browser
Open your web browser and go to:
---
## π― Using the Interface
### Ask Questions Tab
1. **Select Language:** Choose English π¬π§ or German π©πͺ
2. **Enter Question:** Type your question
3. **Provide Context:** Paste the passage containing the answer
4. **Click "Get Answer":** The model will extract the answer
**Tips:**
- Keep context under 300 words for best results
- Make sure the answer is explicitly stated in the context
- Use clear, direct questions
### Try Examples
1. Click on "Try Examples" section
2. Select example type (General Knowledge, Historical, Scientific)
3. Click "Load Example"
4. The question and context will be filled automatically
5. Click "Get Answer"
---
## π§ Troubleshooting
### Model Not Found Error
**Problem:** `β Failed to load model: Model not found`
**Solution:**
```bash
# Update the model path in app.py
MODEL_PATH = "models/multilingual_model"
# Or download the model:
python download_model.py
CUDA Out of Memory
Problem: RuntimeError: CUDA out of memory
Solution:
# The model will automatically fall back to CPU
# Or reduce batch size in config if running inference in batches
Port Already in Use
Problem: OSError: [Errno 48] Address already in use
Solution:
# Use a different port
python app.py --port 7861
Or kill the process using port 7860:
# Mac/Linux
lsof -ti:7860 | xargs kill -9
# Windows
netstat -ano | findstr :7860
taskkill /PID <PID> /F
Import Errors
Problem: ModuleNotFoundError: No module named 'xxx'
Solution:
# Reinstall dependencies
pip install -r requirements.txt --force-reinstall
π Deploy to Cloud
Deploy to Hugging Face Spaces (Free)
# Install Gradio
pip install gradio
# Deploy (from project directory)
gradio deploy
Deploy to Railway/Render
- Create account on Railway/Render
- Connect your GitHub repository
- Set start command:
python app.py - Deploy!
π Next Steps
Now that you have the app running:
- β Read the full README.md for detailed documentation
- β Check out the notebook/main.ipynb to see training process
- β
Explore the code in
app/directory - β
Try modifying examples in
app/utils.py - β
Add your own test cases in
test_model.py
π‘ Pro Tips
For Development
# Enable debug mode
python app.py --debug
# Share publicly (generates public URL)
python app.py --share
# Run on specific port
python app.py --port 8080
For Production
# Use gunicorn for better performance
gunicorn app:app --workers 4 --bind 0.0.0.0:7860
β Need Help?
- π Check README.md for detailed docs
- π Report issues on GitHub Issues
- π¬ Ask questions in Discussions
Happy Question Answering! π