Update
This commit is contained in:
parent
36888fcd48
commit
5fcef73d3d
4
main.py
4
main.py
@ -19,7 +19,7 @@ def run_compute(a,b,sigma):
|
|||||||
capture_output=True,
|
capture_output=True,
|
||||||
text=True
|
text=True
|
||||||
)
|
)
|
||||||
return result.stdout.strip()
|
return int(result.stdout.strip().strip('"'))
|
||||||
|
|
||||||
@app.post("/compute")
|
@app.post("/compute")
|
||||||
async def compute(data: ComputeInput):
|
async def compute(data: ComputeInput):
|
||||||
@ -37,7 +37,7 @@ async def compute(data: ComputeInput):
|
|||||||
futures = [executor.submit(run_compute, a, b, sigma) for a, b in ranges]
|
futures = [executor.submit(run_compute, a, b, sigma) for a, b in ranges]
|
||||||
results = [f.result() for f in futures]
|
results = [f.result() for f in futures]
|
||||||
|
|
||||||
return results
|
return sum(results)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
uvicorn.run(app, host="0.0.0.0", port=8000)
|
uvicorn.run(app, host="0.0.0.0", port=8000)
|
||||||
|
Loading…
Reference in New Issue
Block a user