The file /app/original.py contains distributed_histogram. It splits a
1-D float array into workers shards, pre-computes global bin edges using
numpy.histogram_bin_edges, then computes a partial histogram on each shard
using those shared edges. The partial counts are summed to produce the global
histogram.
Your task
Port this workflow to Modal and save the result as /app/solution/modal_app.py.
The file must define:
A module-level app object.
A module-level run_case Modal Function. The verifier calls
run_case (invoked remotely with case) where case is a dict with keys:
"data": list of floats (1-D)
"bins": integer number of bins
"workers": integer number of shards
run_case must return a dict with keys "counts" (list of int, length bins)
and "bin_edges" (list of float, length bins+1).
Capability contract
Expose the workflow as a single Modal remote function: define run_case as an @app.function so the harness can invoke it with run_case.remote(case).