Skip to content

Latest commit

 

History

History
88 lines (62 loc) · 1.93 KB

README.md

File metadata and controls

88 lines (62 loc) · 1.93 KB

reverse-search-api

A robust API that converts images into structured, actionable data. By pairing the visual search power of Google Lens with the Wikipedia encyclopedia, this tool identifies objects and provides instant cultural or technical context.


Key Highlights

  • Visual Identification: Extracts the most relevant visual matches.
  • Semantic Enrichment: Automatic summaries via the Wikipedia-API.
  • Performance: High-performance asynchronous backend powered by FastAPI.
  • Strict Validation: Uses Pydantic to ensure the integrity of inputs and outputs.

Tech Stack

  • Backend: FastAPI (Python 3.10+)
  • Automation: Selenium (Chrome Headless)
  • Parsing: BeautifulSoup4 & LXML
  • Enrichment: Wikipedia-API

Installation & Configuration

1. Cloning & Environment

git clone https://github.com/your-username/image-to-info-api.git
cd image-to-info-api
python -m venv venv
source venv/bin/activate  # venv\Scripts\activate on Windows
pip install -r requirements.txt

2. Drivers

Ensure you have chromedriver installed and that it matches your current version of Chrome.

3. Launching

uvicorn main:app --host 0.0.0.0 --port 8000 --reload

📡 Endpoint Documentation

POST /reverse-search

Analyzes a remote image and returns the results.

Request Body:

{
    "img_url": "https://url-to-your-image.jpg",
    "max_result": 3
}

Sample Response:

{
  "success": true,
  "data": {
    "knowledgeGraph": {
      "title": "Xbox Series S",
      "description": "The Xbox Series S is a video game console developed by Microsoft...",
      "url": "https://en.wikipedia.org/wiki/Xbox_Series_X_and_Series_S"
    },
    "visualMatches": [
      {
        "title": "Microsoft Xbox Series S",
        "source": "Store Name",
        "link": "https://example.com/product",
        "thumbnail": "data:image/jpeg;base64..."
      }
    ]
  }
}