File size: 1,880 Bytes
c122703
383ac8a
9ab3421
 
 
383ac8a
c122703
 
 
9ab3421
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
title: Grok-2 AI Interface
emoji: 🤖
colorFrom: indigo
colorTo: blue
sdk: docker
pinned: false
---

# Grok-2 AI Interface

A Docker-based web interface for interacting with Grok-2 AI models. This application provides a secure way to use Grok-2 models for image generation and vision analysis through a server-side implementation.

## Features

- **Image Generation**: Create images from text descriptions using Grok-2-Image-1212
- **Vision Analysis**: Upload images for AI analysis using Grok-2-Vision-1212
- **Secure API Key Handling**: Your API key is stored in your browser and only sent to our backend (not third parties)
- **Server-Side API Calls**: All requests to the Grok-2 API are made securely from the server

## Requirements

- Docker
- Grok-2 API key from xAI

## Running with Docker

1. Build the Docker image:
   ```
   docker build -t grok2-interface .
   ```

2. Run the container:
   ```
   docker run -p 7860:7860 grok2-interface
   ```

3. Open your browser and go to: `http://localhost:7860`

## Using the Application

1. On the first tab, enter your Grok-2 API key and save it
2. Navigate to either the Image Generation or Vision Analysis tab
3. For Image Generation:
   - Enter a detailed text prompt
   - Click "Generate Image"
4. For Vision Analysis:
   - Upload an image
   - Optionally enter a question about the image
   - Click "Analyze Image"

## Deploying to Hugging Face Spaces

To deploy this application to Hugging Face Spaces:

1. Create a new Space with Docker SDK
2. Push this code to the Space's repository
3. The Space will automatically build and deploy the Docker container

## Security Notes

- Your API key is stored in your browser's localStorage
- The key is only sent to our backend server to make API calls
- Our server doesn't log or store your API key
- All communication with the Grok-2 API happens server-side for security