api / templates /index.html
AdarshJi's picture
Upload index.html
99a2283 verified
raw
history blame
4.39 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Image Generation API</title>
<style>
body {
font-family: 'Arial', sans-serif;
background-color: #0d1117;
color: #c9d1d9;
padding: 20px;
}
.container {
max-width: 850px;
margin: auto;
background: #161b22;
padding: 25px;
border-radius: 10px;
box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.5);
border: 1px solid #30363d;
}
h1 {
color: #58a6ff;
text-align: center;
}
h2, h3 {
color: #1f6feb;
}
p {
line-height: 1.6;
}
.endpoint {
padding: 15px;
border-bottom: 1px solid #30363d;
}
code, pre {
display: block;
background-color: #0d1117;
color: #58a6ff;
padding: 10px;
border-radius: 5px;
font-family: 'Courier New', monospace;
white-space: pre-wrap;
word-wrap: break-word;
border-left: 4px solid #58a6ff;
}
.footer {
text-align: center;
margin-top: 20px;
color: #8b949e;
}
</style>
</head>
<body>
<div class="container">
<h1>🌌 Image Generation API</h1>
<p>Generate high-quality AI-powered images using various models and providers.</p>
<h2>⚑ Available Endpoints</h2>
<div class="endpoint">
<h3>πŸš€ Generate Image</h3>
<p><strong>Endpoint:</strong> <code>POST /generate/image</code></p>
<p><strong>Description:</strong> Generates an AI image based on the given prompt.</p>
<p><strong>Request Body:</strong></p>
<pre>{
"prompt": "A futuristic cityscape",
"model": "black-forest-labs-flux-1-dev",
"width": 1024,
"height": 1024,
"guidance_scale": 3.5,
"seed": 0,
"provider": "blackforestlabs"
}</pre>
<p><strong>Response Example:</strong></p>
<pre>{
"image_url": "http://adarshji-api.hf.space/images/1234567890.jpg"
}</pre>
</div>
<div class="endpoint">
<h3>πŸ“Œ Get Available Providers</h3>
<p><strong>Endpoint:</strong> <code>POST /providers</code></p>
<p><strong>Description:</strong> Retrieves a list of supported image providers.</p>
<p><strong>Response Example:</strong></p>
<pre>{
"providers": ["blackforestlabs", "flux", "blackforestlabs-schnell"]
}</pre>
</div>
<div class="endpoint">
<h3>πŸ“‹ Get Models by Provider</h3>
<p><strong>Endpoint:</strong> <code>GET /generate/image/model</code></p>
<p><strong>Description:</strong> Retrieves available models for a given provider.</p>
<p><strong>Request Body:</strong></p>
<pre>{
"provider": "blackforestlabs"
}</pre>
<p><strong>Response Example:</strong></p>
<pre>{
"models": ["flux-1", "flux-2", "hyper-realistic-v3"]
}</pre>
</div>
<div class="endpoint">
<h3>🏠 Homepage</h3>
<p><strong>Endpoint:</strong> <code>GET /</code></p>
<p><strong>Description:</strong> Returns this documentation page.</p>
</div>
<h2>🐍 Python Usage Example</h2>
<p>Here is how you can use the API in Python to generate an image:</p>
<pre><code>import requests
url = "http://adarshji-api.hf.space/generate/image"
data = {
"prompt": "A futuristic cityscape",
"model": "black-forest-labs-flux-1-dev",
"width": 1024,
"height": 1024,
"guidance_scale": 3.5,
"seed": 0,
"provider": "blackforestlabs"
}
response = requests.post(url, json=data)
if response.status_code == 200:
print("Image URL:", response.json()["image_url"])
else:
print("Error:", response.json())</code></pre>
<div class="footer">
<p>πŸš€ API v1.0 | Designed for developers</p>
</div>
</div>
</body>
</html>