Update app.py
Browse files
app.py
CHANGED
|
@@ -6,8 +6,25 @@ import numpy as np
|
|
| 6 |
from PIL import Image
|
| 7 |
import io
|
| 8 |
import tempfile
|
|
|
|
| 9 |
from sympy import symbols, diff, integrate, limit, sin, cos, tan, log, sqrt, factorial, Matrix, oo, E, I, pi
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
# Try to import optional dependencies with fallbacks
|
| 12 |
try:
|
| 13 |
import speech_recognition as sr
|
|
|
|
| 6 |
from PIL import Image
|
| 7 |
import io
|
| 8 |
import tempfile
|
| 9 |
+
import subprocess
|
| 10 |
from sympy import symbols, diff, integrate, limit, sin, cos, tan, log, sqrt, factorial, Matrix, oo, E, I, pi
|
| 11 |
|
| 12 |
+
print("🚀 Math Solver starting...")
|
| 13 |
+
|
| 14 |
+
# Install system dependencies
|
| 15 |
+
def install_dependencies():
|
| 16 |
+
try:
|
| 17 |
+
print("Installing system dependencies...")
|
| 18 |
+
subprocess.run(["apt-get", "update", "-y"], capture_output=True)
|
| 19 |
+
subprocess.run(["apt-get", "install", "-y", "tesseract-ocr", "libtesseract-dev", "espeak", "espeak-ng"], capture_output=True)
|
| 20 |
+
print("✅ System dependencies installed")
|
| 21 |
+
return True
|
| 22 |
+
except Exception as e:
|
| 23 |
+
print(f"⚠️ Dependency warning: {e}")
|
| 24 |
+
return False
|
| 25 |
+
|
| 26 |
+
install_dependencies()
|
| 27 |
+
|
| 28 |
# Try to import optional dependencies with fallbacks
|
| 29 |
try:
|
| 30 |
import speech_recognition as sr
|