Spaces:
Sleeping
Sleeping
File size: 2,304 Bytes
2a729e6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | """
Quick start example for OmniParser API
"""
import subprocess
import sys
import time
import requests
from pathlib import Path
def main():
"""Quick start guide"""
print("\n" + "=" * 60)
print("OmniParser-v2.0 QUICK START GUIDE")
print("=" * 60 + "\n")
print("This guide will help you get started with OmniParser API.\n")
# Step 1: Virtual Environment
print("STEP 1: Setup Virtual Environment")
print("-" * 60)
print("Windows:")
print(" python -m venv venv")
print(" venv\\Scripts\\activate.bat")
print("\nLinux/macOS:")
print(" python3 -m venv venv")
print(" source venv/bin/activate\n")
# Step 2: Install Dependencies
print("STEP 2: Install Dependencies")
print("-" * 60)
print("Run: pip install -r requirements.txt")
print("(This will take a few minutes)\n")
# Step 3: Configuration
print("STEP 3: Configuration")
print("-" * 60)
print("Copy .env.example to .env and edit if needed")
print("Run: copy .env.example .env (Windows)")
print(" or: cp .env.example .env (Linux/macOS)\n")
# Step 4: Run Server
print("STEP 4: Run the Server")
print("-" * 60)
print("Run: python main.py")
print("Expected output: 'INFO: Uvicorn running on http://0.0.0.0:8000'\n")
# Step 5: Test API
print("STEP 5: Test the API")
print("-" * 60)
print("Option A - Interactive Docs:")
print(" Open: http://localhost:8000/docs")
print(" Click 'Try it out' on any endpoint\n")
print("Option B - Python Script:")
print(" python test_api.py\n")
print("Option C - cURL:")
print(" curl -X GET http://localhost:8000/health\n")
# Next Steps
print("NEXT STEPS:")
print("-" * 60)
print("1. Upload a screenshot: POST /parse")
print("2. Extract UI elements with coordinates")
print("3. Integrate with your application\n")
print("For more information:")
print("- See README.md for detailed documentation")
print("- Visit: https://huggingface.co/microsoft/OmniParser-v2.0")
print("- API Docs: http://localhost:8000/docs\n")
print("=" * 60 + "\n")
if __name__ == "__main__":
main()
|