saad-sust commited on
Commit
6204112
Β·
verified Β·
1 Parent(s): 784ecc3

Upload README.md

Browse files

Fix Hugging Face Space configuration metadata

Files changed (1) hide show
  1. README.md +42 -50
README.md CHANGED
@@ -1,6 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
  # Saad.AI β€” B.Sc. Mathematics Engine
2
 
3
- Saad.AI is an academic mathematics assistant for university students. It combines a deterministic **SymPy computation engine** with configurable AI providers for explanations, proofs, theory questions, graph descriptions, and image/PDF-based problem solving. See [PORTFOLIO.md](PORTFOLIO.md) for the project story and demo flow.
4
 
5
  > **Important:** SymPy verification applies only when a request matches one of the implemented deterministic adapters. General proofs, theory questions, unsupported matrix formats, and unsupported subjects are treated as AI-generated unless a deterministic adapter returns a verified result.
6
 
@@ -22,48 +34,36 @@ Saad.AI is an academic mathematics assistant for university students. It combine
22
 
23
  The engine is intentionally not presented as a universal proof checker. For questions that cannot be deterministically parsed, the application sends the prompt to the configured AI provider and labels the result as AI-generated where appropriate.
24
 
25
- ## Architecture
26
 
27
- The current stabilization refactor keeps Streamlit as the user interface while separating the main responsibilities:
28
 
29
  ```text
30
- math-engine/
31
- β”œβ”€β”€ app.py # Streamlit UI, session flow, and graph rendering
32
- β”œβ”€β”€ src/
33
- β”‚ β”œβ”€β”€ engine/
34
- β”‚ β”‚ └── sympy_engine.py # Deterministic symbolic and numeric adapters
35
- β”‚ └── services/
36
- β”‚ └── ai.py # Provider rotation, vision, uploads, verification
37
- β”œβ”€β”€ tests/
38
- β”‚ └── test_engine.py # Deterministic engine regression tests
39
- β”œβ”€β”€ requirements.txt # Runtime dependencies actually used by the app
40
- └── README.md
41
- ```
42
-
43
- The next recommended phase is to split the remaining UI, persistence, and plotting concerns into their own modules and add provider mocks and upload fixtures.
44
-
45
- ## Run locally
46
-
47
- ```bash
48
- git clone https://github.com/almuyed-saad/math-engine.git
49
- cd math-engine
50
- python -m venv .venv
51
- source .venv/bin/activate
52
- pip install -r requirements.txt
53
- streamlit run app.py
54
  ```
55
 
56
- Open `http://localhost:8501` in a browser.
57
 
58
- Run the deterministic regression tests with:
59
 
60
- ```bash
61
- python -m unittest discover -s tests -v
 
 
 
 
 
 
 
62
  ```
63
 
64
  ## Configuration
65
 
66
- AI providers are optional for deterministic SymPy requests but required for explanations and unsupported subjects. Configure provider credentials through environment variables or Hugging Face Space secrets:
67
 
68
  ```text
69
  GROQ_API_KEY_1
@@ -76,28 +76,20 @@ GEMINI_API_KEY_4
76
  OPENROUTER_API_KEY
77
  ```
78
 
79
- Chat history is intentionally **session-local** in the portfolio edition. This keeps the application easy to understand and deploy while still allowing users to create, switch, and delete conversations during a demo session. A database is not required.
80
 
81
- ## Example prompts
82
 
83
- ```text
84
- Find the derivative of x^3 + 5x^2 - 3x + 7
85
- Integrate sin(x) * e^x dx
86
- Find limit of sin(x)/x as x -> 0
87
- Apply Newton-Raphson to x^3 - 2x - 5 = 0, x0=2, 3 iterations
88
- Apply bisection of x^3 - x on [0, 2], 4 iterations
89
- Find gcd of 84 and 30
90
- Solve 14x ≑ 30 (mod 44) using Euclidean algorithm
91
- Plot y = x^2 - 4 from -3 to 3
92
  ```
93
 
94
- ## Deployment notes
95
-
96
- The active source uses hosted API providers rather than loading a local Hugging Face model at runtime. The dependency list therefore excludes the previously declared `transformers` and `torch` packages, which were not used by the current application and added unnecessary deployment weight.
97
-
98
- Runtime configuration is centralized in `src/config.py`. Copy `.env.example` to `.env` for local development, or add the same variables as Hugging Face Space secrets. Provider timeouts, upload size, and PDF page limits are validated and clamped at startup so malformed deployment values cannot create unbounded resource usage.
99
-
100
- For a portfolio deployment, add the provider secrets to Hugging Face Spaces or another Streamlit host, then launch the app with `streamlit run app.py`. No database or authentication setup is required. Every push and pull request runs the deterministic test suite and Python compilation checks through [`.github/workflows/ci.yml`](.github/workflows/ci.yml).
101
 
102
  ## Credits
103
 
 
1
+ ---
2
+ title: Saad.AI
3
+ emoji: 🧠
4
+ colorFrom: blue
5
+ colorTo: indigo
6
+ sdk: streamlit
7
+ sdk_version: "1.32.0"
8
+ python_version: "3.10"
9
+ app_file: app.py
10
+ pinned: false
11
+ ---
12
+
13
  # Saad.AI β€” B.Sc. Mathematics Engine
14
 
15
+ Saad.AI is an academic mathematics assistant for university students. It combines a deterministic **SymPy computation engine** with configurable AI providers for explanations, proofs, theory questions, graph descriptions, and image/PDF-based problem solving.
16
 
17
  > **Important:** SymPy verification applies only when a request matches one of the implemented deterministic adapters. General proofs, theory questions, unsupported matrix formats, and unsupported subjects are treated as AI-generated unless a deterministic adapter returns a verified result.
18
 
 
34
 
35
  The engine is intentionally not presented as a universal proof checker. For questions that cannot be deterministically parsed, the application sends the prompt to the configured AI provider and labels the result as AI-generated where appropriate.
36
 
37
+ ## Portfolio architecture
38
 
39
+ The deployed Space uses a flat layout because the Hugging Face web uploader preserves uploaded filenames. The responsibilities remain separated into the same modules used by the GitHub portfolio branch:
40
 
41
  ```text
42
+ app.py # Streamlit UI, session flow, and graph rendering
43
+ config.py # Centralized provider and runtime configuration
44
+ sympy_engine.py # Deterministic symbolic and numeric adapters
45
+ ai.py # Provider rotation, vision, uploads, and verification
46
+ requirements.txt # Runtime dependencies
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
  ```
48
 
49
+ Chat history is intentionally **session-local** in the portfolio edition. This keeps the application easy to understand and deploy while still allowing users to create, switch, and delete conversations during a demo session. A database is not required.
50
 
51
+ ## Example prompts
52
 
53
+ ```text
54
+ Find the derivative of x^3 + 5x^2 - 3x + 7
55
+ Integrate sin(x) * e^x dx
56
+ Find limit of sin(x)/x as x -> 0
57
+ Apply Newton-Raphson to x^3 - 2x - 5 = 0, x0=2, 3 iterations
58
+ Apply bisection of x^3 - x on [0, 2], 4 iterations
59
+ Find gcd of 84 and 30
60
+ Solve 14x ≑ 30 (mod 44) using Euclidean algorithm
61
+ Plot y = x^2 - 4 from -3 to 3
62
  ```
63
 
64
  ## Configuration
65
 
66
+ AI providers are optional for deterministic SymPy requests but required for explanations and unsupported subjects. Configure provider credentials through Hugging Face Space secrets:
67
 
68
  ```text
69
  GROQ_API_KEY_1
 
76
  OPENROUTER_API_KEY
77
  ```
78
 
79
+ If providers are unavailable, supported deterministic requests still return their verified SymPy result instead of failing with β€œAll providers failed.”
80
 
81
+ ## Local development
82
 
83
+ ```bash
84
+ git clone https://github.com/almuyed-saad/math-engine.git
85
+ cd math-engine
86
+ python -m venv .venv
87
+ source .venv/bin/activate
88
+ pip install -r requirements.txt
89
+ streamlit run app.py
 
 
90
  ```
91
 
92
+ The project source and full test suite are maintained in the [GitHub repository](https://github.com/almuyed-saad/math-engine/tree/refactor/stabilize-saadai).
 
 
 
 
 
 
93
 
94
  ## Credits
95