A modern AI image generation web application that supports multiple AI platforms, providing real-time image generation, download, and management features.
Deploy with EdgeOne Pages.
Clone the Repository
git clone <repository-url>
cd generate-graph
Install Dependencies
npm install
# or
yarn install
Configure Environment Variables
Create a .env file and add the following configuration (not all required):
# Hugging Face API Token
HF_TOKEN=your_huggingface_token_here
# Nebius API Token
NEBIUS_TOKEN=your_nebius_token_here
# Replicate API Token
REPLICATE_TOKEN=your_replicate_token_here
# OPENAI API Key
OPENAI_API_KEY=your_openai_api_key_here
# FAL API Key
FAL_KEY=your_fal_key_here
The EdgeOne Pages deployment console environment variable configuration is consistent with the above .env file.
Start Development Server
npm run dev
# or
yarn dev
Access the Application Open your browser and visit http://localhost:3000
HF_TOKEN environment variableNEBIUS_TOKEN environment variableREPLICATE_TOKEN environment variableOPENAI_API_KEY environment variableFAL_KEY environment variableThe application automatically checks the availability of tokens for each platform and displays the status in the interface:
Select Model
Enter Prompt
Generate Image
Download Image
Endpoint: POST /v1/generate
Request Body:
{
"image": "Image description text",
"platform": "huggingface",
"model": "Model identifier"
}
Response:
{
"success": true,
"prompt": "Original prompt",
"imageData": "Base64 encoded image data or URL",
"message": "Generation success message"
}
Endpoint: GET /v1/token-status
Response:
{
"hfToken": true,
"nebiusToken": true,
"replicateToken": false
}
All API endpoints include unified error handling:
400 - Request parameter errors or content violations429 - Request rate limit exceeded500 - Internal server errorgenerate-graph/
├── functions/ # EdgeOne Functions
│ ├── v1/
│ │ ├── generate/ # Image generation API
│ │ │ ├── index.js # Main processing logic
│ │ │ ├── fetch_utils.js # API call utilities
│ │ │ └── nfsw_limit.js # Content filtering
│ │ └── token-status/ # Token status API
│ └── helloworld/ # Example function
├── src/
│ ├── components/ # React components
│ │ ├── ImageDisplay.tsx # Image display component
│ │ └── ModelDropdown.tsx # Model selection component
│ ├── pages/ # Next.js pages
│ │ ├── _app.tsx # Application entry
│ │ ├── _document.tsx # Document configuration
│ │ └── index.tsx # Main page
│ └── styles/ # Style files
│ └── globals.css # Global styles
├── public/ # Static assets
├── package.json # Project configuration
├── next.config.ts # Next.js configuration
├── tailwind.config.js # Tailwind configuration
└── README.md # Project documentation