zenotaiz's picture
Matrix Orchestrator: Pushing latest generic heavy engine
d278e8a verified
raw
history blame contribute delete
721 Bytes
from fastapi import FastAPI
import math
import time
app = FastAPI()
@app.get("/")
def read_root():
return {"status": "awake", "message": "The 16GB Engine is hot."}
@app.get("/heavy-math")
def do_heavy_math():
start_time = time.time()
primes = []
for num in range(2, 50000):
is_prime = True
for i in range(2, int(math.sqrt(num)) + 1):
if (num % i) == 0:
is_prime = False
break
if is_prime:
primes.append(num)
end_time = time.time()
return {
"message": "Heavy job complete in Python",
"primes_found": len(primes),
"seconds_taken": round(end_time - start_time, 2)
}