Haultics™ — Freight Market Intelligence

● System Active | Ready
--
--
--
--
Market Average: The current fair price based on historical data and fuel costs.

Target Negotiation: Use this for aggressive bidding. Represents a -5% optimization goal.

Max Allowed: The critical ceiling. Rates above this limit indicate overpayment.
import asyncio, json from pyodide.http import pyfetch from pyodide.ffi import create_proxy from pyscript import document, window async def process_prediction(event): origin = document.getElementById("origin").value destination = document.getElementById("destination").value status = document.getElementById("status") status.innerText = "● Fetching prediction..." try: response = await pyfetch( "https://freight-ai-backend.onrender.com/api/predict", method="POST", body=json.dumps({"origin": origin, "destination": destination}), headers={"Content-Type":"application/json"} ) data = await response.json() document.getElementById("market_avg").innerText = f"${data['market']:.2f} USD" document.getElementById("target_neg").innerText = f"${data['target']:.2f} USD" document.getElementById("max_allow").innerText = f"${data['max']:.2f} USD" document.getElementById("dist_val").innerText = f"{data['miles']} miles" window.updateMap(data["lat1"], data["lon1"], data["lat2"], data["lon2"], origin, destination) status.innerText = f"● System Active | Fuel: ${data['fuel']:.2f} USD" except Exception as e: status.innerText = f"● Error: {e}" async def main(): btn = document.getElementById("calc_btn") btn.addEventListener("click", create_proxy(process_prediction)) asyncio.ensure_future(main())