• bitcoinBitcoin(BTC)$77,571.001.39%
  • ethereumEthereum(ETH)$2,255.321.25%
  • tetherTether(USDT)$1.000.05%
  • binancecoinBNB(BNB)$707.181.58%
  • rippleXRP(XRP)$1.261.30%
  • usd-coinUSDC(USDC)$1.000.05%
  • solanaSolana(SOL)$95.971.91%
  • tronTRON(TRX)$0.307033-7.39%
  • Figure HelocFigure Heloc(FIGR_HELOC)$1.02-0.23%
  • zcashZcash(ZEC)$1,279.375.22%
  • HyperliquidHyperliquid(HYPE)$87.90-2.55%
  • dogecoinDogecoin(DOGE)$0.0759381.75%
  • moneroMonero(XMR)$594.330.84%
  • USDSUSDS(USDS)$1.00-0.01%
  • chainlinkChainlink(LINK)$11.826.52%
  • whitebitWhiteBIT Coin(WBT)$74.471.40%
  • leo-tokenLEO Token(LEO)$9.26-1.58%
  • cardanoCardano(ADA)$0.1937271.41%
  • stellarStellar(XLM)$0.1697211.44%
  • nearNEAR Protocol(NEAR)$4.484.73%
  • bitcoin-cashBitcoin Cash(BCH)$287.520.79%
  • daiDai(DAI)$1.000.06%
  • RainRain(RAIN)$0.0063681.16%
  • Ethena USDeEthena USDe(USDE)$1.000.08%
  • uniswapUniswap(UNI)$7.133.47%
  • litecoinLitecoin(LTC)$55.901.88%
  • CantonCanton(CC)$0.0970252.34%
  • USD1USD1(USD1)$1.000.06%
  • avalanche-2Avalanche(AVAX)$8.613.00%
  • suiSui(SUI)$0.902.41%
  • the-open-networkGram (prev. Toncoin)(GRAM)$1.215.25%
  • hedera-hashgraphHedera(HBAR)$0.0721451.41%
  • tether-goldTether Gold(XAUT)$3,874.46-0.24%
  • Global DollarGlobal Dollar(USDG)$1.000.04%
  • quant-networkQuant(QNT)$204.658.56%
  • paypal-usdPayPal USD(PYUSD)$1.000.00%
  • BittensorBittensor(TAO)$238.303.55%
  • shiba-inuShiba Inu(SHIB)$0.000005-0.09%
  • crypto-com-chainCronos(CRO)$0.0517362.05%
  • EthenaEthena(ENA)$0.1909983.61%
  • Ripple USDRipple USD(RLUSD)$1.000.05%
  • Ondo US Dollar YieldOndo US Dollar Yield(USDY)$1.150.13%
  • Circle USYCCircle USYC(USYC)$1.140.00%
  • okbOKB(OKB)$110.871.15%
  • pepePepe(PEPE)$0.0000050.58%
  • MemeCoreMemeCore(M)$0.91-3.36%
  • aaveAave(AAVE)$134.737.21%
  • BlackRock USD Institutional Digital Liquidity FundBlackRock USD Institutional Digital Liquidity Fund(BUIDL)$1.000.00%
  • OndoOndo(ONDO)$0.4105023.17%
  • Pump.funPump.fun(PUMP)$0.0042507.31%
TradePoint.io
  • Main
  • AI & Technology
  • Stock Charts
  • Market & News
  • Business
  • Finance Tips
  • Trade Tube
  • Blog
  • Shop
No Result
View All Result
TradePoint.io
No Result
View All Result

How to Build a Vision-Guided Web AI Agent with MolmoWeb-4B Using Multimodal Reasoning and Action Prediction

March 25, 2026
in AI & Technology
Reading Time: 3 mins read
A A
How to Build a Vision-Guided Web AI Agent with MolmoWeb-4B Using Multimodal Reasoning and Action Prediction
ShareShareShareShareShare
def parse_click_coords(action_str):
   """
   Extract normalised (x, y) coordinates from a click action string.
   e.g., 'click(0.45, 0.32)' -> (0.45, 0.32)
   Returns None if the action is not a click.
   """
   match = re.search(r"click\(\s*([\d.]+)\s*,\s*([\d.]+)\s*\)", action_str)
   if match:
       return float(match.group(1)), float(match.group(2))
   return None




def parse_action_details(action_str):
   """
   Parse a MolmoWeb action string into a structured dict.
   Returns:  {"type": "click", "x": 0.45, "y": 0.32}
             {"type": "goto", "url": "https://..."}
             {"type": "type", "text": "query text"}
             {"type": "scroll", "direction": "down"}
             {"type": "press", "key": "Enter"}
             {"type": "send_msg", "message": "The answer is ..."}
             {"type": "unknown", "raw": "..."}
   """
   action_str = action_str.strip()


   m = re.match(r'click\(\s*([\d.]+)\s*,\s*([\d.]+)\s*\)', action_str)
   if m:
       return {"type": "click", "x": float(m.group(1)), "y": float(m.group(2))}


   m = re.match(r'goto\(\s*["\'](.+?)["\']\s*\)', action_str)
   if m:
       return {"type": "goto", "url": m.group(1)}


   m = re.match(r'type\(\s*["\'](.+?)["\']\s*\)', action_str)
   if m:
       return {"type": "type", "text": m.group(1)}


   m = re.match(r'scroll\(\s*["\']?(up|down)["\']?\s*\)', action_str)
   if m:
       return {"type": "scroll", "direction": m.group(1)}


   m = re.match(r'press\(\s*["\'](.+?)["\']\s*\)', action_str)
   if m:
       return {"type": "press", "key": m.group(1)}


   m = re.match(r'send_msg\(\s*["\'](.+?)["\']\s*\)', action_str, re.DOTALL)
   if m:
       return {"type": "send_msg", "message": m.group(1)}


   m = re.match(r'(new_tab|go_back|switch_tab)\(\s*(\d*)\s*\)', action_str)
   if m:
       result = {"type": m.group(1)}
       if m.group(2):
           result["tab"] = int(m.group(2))
       return result


   return {"type": "unknown", "raw": action_str}




def visualise_click(image, action_str, title="MolmoWeb Prediction"):
   """
   Draw the predicted click location on the screenshot and display it.
   Coordinates are normalised (0-1); we convert to pixel space.
   """
   coords = parse_click_coords(action_str)


   fig, ax = plt.subplots(1, 1, figsize=(12, 7))
   ax.imshow(image)
   ax.set_title(title, fontsize=14)


   if coords:
       x_norm, y_norm = coords
       w, h = image.size
       x_px, y_px = x_norm * w, y_norm * h


       circle = patches.Circle(
           (x_px, y_px), radius=18, linewidth=3,
           edgecolor="red", facecolor="none"
       )
       ax.add_patch(circle)
       ax.plot(x_px, y_px, "r+", markersize=20, markeredgewidth=3)


       ax.annotate(
           f"click({x_norm:.3f}, {y_norm:.3f})",
           (x_px, y_px), xytext=(x_px + 25, y_px - 25),
           fontsize=11, color="white",
           bbox=dict(boxstyle="round,pad=0.3", facecolor="red", alpha=0.8),
           arrowprops=dict(arrowstyle="->", color="red", lw=2),
       )
   else:
       ax.text(
           0.5, 0.02, f"Action: {action_str}", transform=ax.transAxes,
           fontsize=12, ha="center", color="white",
           bbox=dict(boxstyle="round,pad=0.4", facecolor="blue", alpha=0.8),
       )


   ax.axis("off")
   plt.tight_layout()
   plt.show()




def download_image(url, size=(1280, 720)):
   """Download an image from a URL and resize to browser viewport dimensions."""
   response = requests.get(url, timeout=15)
   img = Image.open(BytesIO(response.content)).convert("RGB")
   img = img.resize(size, Image.LANCZOS)
   return img




def create_synthetic_webpage(title="Example Page", elements=None):
   """
   Create a synthetic webpage screenshot for testing.
   'elements' is a list of dicts: {"type": "button"|"input"|"text"|"link",
                                    "text": str, "pos": (x, y)}
   """
   img = Image.new("RGB", (1280, 720), color=(255, 255, 255))
   draw = ImageDraw.Draw(img)


   draw.rectangle([0, 0, 1280, 50], fill=(240, 240, 240))
   draw.rectangle([180, 10, 900, 40], outline=(200, 200, 200), width=1, fill="white")
   draw.text((200, 16), f"https://www.example.com", fill=(100, 100, 100))


   for cx in [30, 60, 90]:
       draw.ellipse([cx - 8, 17, cx + 8, 33], fill=(200, 200, 200))


   draw.text((50, 70), title, fill="black")


   if elements:
       for el in elements:
           x, y = el["pos"]
           if el["type"] == "button":
               draw.rectangle([x, y, x + 150, y + 35], fill=(66, 133, 244))
               draw.text((x + 10, y + 8), el["text"], fill="white")
           elif el["type"] == "input":
               draw.rectangle([x, y, x + 300, y + 35], outline=(180, 180, 180), width=2)
               draw.text((x + 10, y + 8), el["text"], fill=(150, 150, 150))
           elif el["type"] == "text":
               draw.text((x, y), el["text"], fill="black")
           elif el["type"] == "link":
               draw.text((x, y), el["text"], fill=(66, 133, 244))


   return img




print("Helper functions defined successfully.")




print("\n" + "=" * 70)
print("SECTION 5: Single-step inference - blank page (cold start)")
print("=" * 70)
print("The agent starts at about:blank and must decide its first action.\n")


blank_image = Image.new("RGB", (1280, 720), color="white")


task = "Go to arxiv.org and find the latest paper about Molmo from Ai2"


prompt = build_prompt(
   task_description=task,
   page_url="about:blank",
   page_index=0,
)


print(f"Task: {task}")
print("Screenshot: blank white image (about:blank)")
print("Running inference...\n")


raw_output = run_inference(prompt, blank_image)


print(f"Raw model output:\n{raw_output}\n")


parsed = parse_thought_and_action(raw_output)
print(f"Thought: {parsed['thought']}")
print(f"Action:  {parsed['action']}")


action_details = parse_action_details(parsed["action"])
print(f"Parsed:  {action_details}")

Credit: Source link

YOU MAY ALSO LIKE

4 Drawbacks You Should Know Before Buying A PlayStation 5

Cisco Talos Details VOLTA Infostealer’s LLM Victim-Ranking Stage – Unite.AI

ShareTweetSendSharePin

Related Posts

4 Drawbacks You Should Know Before Buying A PlayStation 5
AI & Technology

4 Drawbacks You Should Know Before Buying A PlayStation 5

October 31, 2026
Cisco Talos Details VOLTA Infostealer’s LLM Victim-Ranking Stage – Unite.AI
AI & Technology

Cisco Talos Details VOLTA Infostealer’s LLM Victim-Ranking Stage – Unite.AI

October 31, 2026
NASA’s Second Year-Long Mars Simulation Mission Ends Today
AI & Technology

NASA’s Second Year-Long Mars Simulation Mission Ends Today

October 31, 2026
Here’s How Much The iPhone Pro Cost In 2019 Vs. 2026
AI & Technology

Here’s How Much The iPhone Pro Cost In 2019 Vs. 2026

October 31, 2026
Next Post
Viatris Inc. (VTRS) Discusses Long-Term Growth Outlook and Portfolio Strategy Across Generics, Established Brands and Innovative Medicines Transcript

Viatris Inc. (VTRS) Discusses Long-Term Growth Outlook and Portfolio Strategy Across Generics, Established Brands and Innovative Medicines Transcript

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Search

No Result
View All Result
4 Drawbacks You Should Know Before Buying A PlayStation 5

4 Drawbacks You Should Know Before Buying A PlayStation 5

October 31, 2026
Fed meeting live updates: No hike expected, but investors watching Warsh for what's next – CNBC

Fed meeting live updates: No hike expected, but investors watching Warsh for what's next – CNBC

October 28, 2026
9 people dead in Pennsylvania mass shooting

9 people dead in Pennsylvania mass shooting

October 28, 2026

About

Learn more

Our Services

Legal

Privacy Policy

Terms of Use

Bloggers

Learn more

Article Links

Contact

Advertise

Ask us anything

©2020- TradePoint.io - All rights reserved!

Tradepoint.io, being just a publishing and technology platform, is not a registered broker-dealer or investment adviser. So we do not provide investment advice. Rather, brokerage services are provided to clients of Tradepoint.io by independent SEC-registered broker-dealers and members of FINRA/SIPC. Every form of investing carries some risk and past performance is not a guarantee of future results. “Tradepoint.io“, “Instant Investing” and “My Trading Tools” are registered trademarks of Apperbuild, LLC.

This website is operated by Apperbuild, LLC. We have no link to any brokerage firm and we do not provide investment advice. Every information and resource we provide is solely for the education of our readers. © 2020 Apperbuild, LLC. All rights reserved.

No Result
View All Result
  • Main
  • AI & Technology
  • Stock Charts
  • Market & News
  • Business
  • Finance Tips
  • Trade Tube
  • Blog
  • Shop

© 2023 - TradePoint.io - All Rights Reserved!