megharudushi commited on
Commit
c85f4fd
·
verified ·
1 Parent(s): 2d169db

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +76 -4
app.py CHANGED
@@ -1338,7 +1338,7 @@ Be precise and methodical in your approach."""
1338
  )
1339
 
1340
 
1341
- # Alternative endpoint path for compatibility
1342
  @app.post("/v1/computer-use")
1343
  async def computer_use_alt(
1344
  request: CUARequest,
@@ -1349,6 +1349,74 @@ async def computer_use_alt(
1349
  return await computer_use_agent(request, authorization, x_api_key)
1350
 
1351
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1352
  # ============================================================================
1353
  # Health & Info Endpoints
1354
  # ============================================================================
@@ -1373,11 +1441,15 @@ async def root():
1373
  "endpoints": {
1374
  "openai_chat": "/v1/chat/completions",
1375
  "anthropic_messages": "/v1/messages",
1376
- "computer_use": "/v1/cua",
1377
- "computer_use_alt": "/v1/computer-use",
1378
  "models": "/v1/models"
1379
  },
1380
- "cua_model": "sheikh-computer-use-preview",
 
 
 
 
 
 
1381
  "docs": "/docs"
1382
  }
1383
 
 
1338
  )
1339
 
1340
 
1341
+ # Alternative endpoint paths for compatibility
1342
  @app.post("/v1/computer-use")
1343
  async def computer_use_alt(
1344
  request: CUARequest,
 
1349
  return await computer_use_agent(request, authorization, x_api_key)
1350
 
1351
 
1352
+ # ============================================================================
1353
+ # CUA Separate Base Path: /cua/v1/
1354
+ # ============================================================================
1355
+
1356
+ @app.post("/cua/v1/messages")
1357
+ async def cua_messages(
1358
+ request: CUARequest,
1359
+ authorization: Optional[str] = Header(None),
1360
+ x_api_key: Optional[str] = Header(None, alias="x-api-key"),
1361
+ ):
1362
+ """CUA endpoint with separate base path: /cua/v1/messages"""
1363
+ return await computer_use_agent(request, authorization, x_api_key)
1364
+
1365
+
1366
+ @app.get("/cua/v1/models")
1367
+ async def cua_list_models():
1368
+ """List CUA models"""
1369
+ return {
1370
+ "object": "list",
1371
+ "data": [
1372
+ {
1373
+ "id": "sheikh-computer-use-preview",
1374
+ "object": "model",
1375
+ "created": int(time.time()),
1376
+ "owned_by": "sheikh-ai",
1377
+ "capabilities": {
1378
+ "computer_use": True,
1379
+ "vision": True,
1380
+ "tool_use": True
1381
+ }
1382
+ },
1383
+ {
1384
+ "id": "computer-use-preview",
1385
+ "object": "model",
1386
+ "created": int(time.time()),
1387
+ "owned_by": "sheikh-ai",
1388
+ "capabilities": {
1389
+ "computer_use": True,
1390
+ "vision": True,
1391
+ "tool_use": True
1392
+ }
1393
+ }
1394
+ ]
1395
+ }
1396
+
1397
+
1398
+ @app.get("/cua")
1399
+ async def cua_info():
1400
+ """CUA base endpoint info"""
1401
+ return {
1402
+ "name": "Sheikh Computer Use Agent (CUA)",
1403
+ "version": "1.0.0",
1404
+ "model": "sheikh-computer-use-preview",
1405
+ "base_url": "/cua/v1",
1406
+ "endpoints": {
1407
+ "messages": "/cua/v1/messages",
1408
+ "models": "/cua/v1/models"
1409
+ },
1410
+ "supported_actions": [
1411
+ "click", "double_click", "right_click",
1412
+ "type", "key", "scroll",
1413
+ "mouse_move", "left_click_drag",
1414
+ "screenshot"
1415
+ ],
1416
+ "screen_default": {"width": 1920, "height": 1080}
1417
+ }
1418
+
1419
+
1420
  # ============================================================================
1421
  # Health & Info Endpoints
1422
  # ============================================================================
 
1441
  "endpoints": {
1442
  "openai_chat": "/v1/chat/completions",
1443
  "anthropic_messages": "/v1/messages",
 
 
1444
  "models": "/v1/models"
1445
  },
1446
+ "cua": {
1447
+ "base_url": "/cua/v1",
1448
+ "messages": "/cua/v1/messages",
1449
+ "models": "/cua/v1/models",
1450
+ "info": "/cua",
1451
+ "model": "sheikh-computer-use-preview"
1452
+ },
1453
  "docs": "/docs"
1454
  }
1455