Spaces:
Sleeping
Sleeping
| title: Gemini AI API (No Login) | |
| emoji: π€ | |
| colorFrom: blue | |
| colorTo: purple | |
| sdk: docker | |
| app_port: 7860 | |
| tags: | |
| - api | |
| - playwright | |
| - gemini | |
| # π€ Gemini AI API (Headless & No-Login) | |
| This is a FastAPI-based wrapper for Google Gemini that runs on Hugging Face Spaces using Playwright. It operates in **Guest Mode** (no login required), opens a fresh browser session for every request, and automatically cleans up afterwards to ensure privacy and stability. | |
| ## β¨ Features | |
| - π **No Login Required:** Runs in guest mode; no cookies or user_data needed. | |
| - π§Ή **Auto-Cleanup:** Fresh browser instance for every API call. | |
| - πΌοΈ **Image Support:** Automatically downloads generated images and uploads them to ImgBB. | |
| - β‘ **FastAPI:** High-performance async API endpoints. | |
| - π³ **Dockerized:** Pre-configured with Chromium and all dependencies. | |
| ## π Setup Instructions | |
| ### 1. Create a Hugging Face Space | |
| - Select **Docker** as the SDK. | |
| - Upload `app.py`, `requirements.txt`, and `Dockerfile`. | |
| ### 2. Configure Secrets | |
| Go to your Space **Settings > Variables and Secrets** and add: | |
| - `IMGBB_API_KEY`: Your API key from [ImgBB](https://api.imgbb.com/) (Required for image uploads). | |
| ### 3. Files Required | |
| Ensure these files are in your repository: | |
| - `app.py` (Main application code) | |
| - `requirements.txt` (Dependencies) | |
| - `Dockerfile` (Installs Chromium + Python deps) | |
| ## π‘ API Usage | |
| ### Endpoint: `/chat` | |
| **Method:** `POST` | |
| **Content-Type:** `application/json` | |
| #### Request Body | |
| ```json | |
| { | |
| "message": "Your prompt here" | |
| } |