Upload index.html
Browse files- templates/index.html +140 -0
templates/index.html
ADDED
@@ -0,0 +1,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="en">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<title>Image Generation API</title>
|
7 |
+
<style>
|
8 |
+
body {
|
9 |
+
font-family: 'Arial', sans-serif;
|
10 |
+
background-color: #0d1117;
|
11 |
+
color: #c9d1d9;
|
12 |
+
padding: 20px;
|
13 |
+
}
|
14 |
+
.container {
|
15 |
+
max-width: 850px;
|
16 |
+
margin: auto;
|
17 |
+
background: #161b22;
|
18 |
+
padding: 25px;
|
19 |
+
border-radius: 10px;
|
20 |
+
box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.5);
|
21 |
+
border: 1px solid #30363d;
|
22 |
+
}
|
23 |
+
h1 {
|
24 |
+
color: #58a6ff;
|
25 |
+
text-align: center;
|
26 |
+
}
|
27 |
+
h2, h3 {
|
28 |
+
color: #1f6feb;
|
29 |
+
}
|
30 |
+
p {
|
31 |
+
line-height: 1.6;
|
32 |
+
}
|
33 |
+
.endpoint {
|
34 |
+
padding: 15px;
|
35 |
+
border-bottom: 1px solid #30363d;
|
36 |
+
}
|
37 |
+
code, pre {
|
38 |
+
display: block;
|
39 |
+
background-color: #0d1117;
|
40 |
+
color: #58a6ff;
|
41 |
+
padding: 10px;
|
42 |
+
border-radius: 5px;
|
43 |
+
font-family: 'Courier New', monospace;
|
44 |
+
white-space: pre-wrap;
|
45 |
+
word-wrap: break-word;
|
46 |
+
border-left: 4px solid #58a6ff;
|
47 |
+
}
|
48 |
+
.footer {
|
49 |
+
text-align: center;
|
50 |
+
margin-top: 20px;
|
51 |
+
color: #8b949e;
|
52 |
+
}
|
53 |
+
</style>
|
54 |
+
</head>
|
55 |
+
<body>
|
56 |
+
<div class="container">
|
57 |
+
<h1>π Image Generation API</h1>
|
58 |
+
<p>Generate high-quality AI-powered images using various models and providers.</p>
|
59 |
+
|
60 |
+
<h2>β‘ Available Endpoints</h2>
|
61 |
+
|
62 |
+
<div class="endpoint">
|
63 |
+
<h3>π Generate Image</h3>
|
64 |
+
<p><strong>Endpoint:</strong> <code>POST /generate/image</code></p>
|
65 |
+
<p><strong>Description:</strong> Generates an AI image based on the given prompt.</p>
|
66 |
+
<p><strong>Request Body:</strong></p>
|
67 |
+
<pre>{
|
68 |
+
"prompt": "A futuristic cityscape",
|
69 |
+
"model": "black-forest-labs-flux-1-dev",
|
70 |
+
"width": 1024,
|
71 |
+
"height": 1024,
|
72 |
+
"guidance_scale": 3.5,
|
73 |
+
"seed": 0,
|
74 |
+
"provider": "blackforestlabs"
|
75 |
+
}</pre>
|
76 |
+
<p><strong>Response Example:</strong></p>
|
77 |
+
<pre>{
|
78 |
+
"image_url": "http://adarshji-api.hf.space/images/1234567890.jpg"
|
79 |
+
}</pre>
|
80 |
+
</div>
|
81 |
+
|
82 |
+
<div class="endpoint">
|
83 |
+
<h3>π Get Available Providers</h3>
|
84 |
+
<p><strong>Endpoint:</strong> <code>POST /providers</code></p>
|
85 |
+
<p><strong>Description:</strong> Retrieves a list of supported image providers.</p>
|
86 |
+
<p><strong>Response Example:</strong></p>
|
87 |
+
<pre>{
|
88 |
+
"providers": ["blackforestlabs", "flux", "blackforestlabs-schnell"]
|
89 |
+
}</pre>
|
90 |
+
</div>
|
91 |
+
|
92 |
+
<div class="endpoint">
|
93 |
+
<h3>π Get Models by Provider</h3>
|
94 |
+
<p><strong>Endpoint:</strong> <code>GET /generate/image/model</code></p>
|
95 |
+
<p><strong>Description:</strong> Retrieves available models for a given provider.</p>
|
96 |
+
<p><strong>Request Body:</strong></p>
|
97 |
+
<pre>{
|
98 |
+
"provider": "blackforestlabs"
|
99 |
+
}</pre>
|
100 |
+
<p><strong>Response Example:</strong></p>
|
101 |
+
<pre>{
|
102 |
+
"models": ["flux-1", "flux-2", "hyper-realistic-v3"]
|
103 |
+
}</pre>
|
104 |
+
</div>
|
105 |
+
|
106 |
+
<div class="endpoint">
|
107 |
+
<h3>π Homepage</h3>
|
108 |
+
<p><strong>Endpoint:</strong> <code>GET /</code></p>
|
109 |
+
<p><strong>Description:</strong> Returns this documentation page.</p>
|
110 |
+
</div>
|
111 |
+
|
112 |
+
<h2>π Python Usage Example</h2>
|
113 |
+
<p>Here is how you can use the API in Python to generate an image:</p>
|
114 |
+
<pre><code>import requests
|
115 |
+
|
116 |
+
url = "http://adarshji-api.hf.space/generate/image"
|
117 |
+
|
118 |
+
data = {
|
119 |
+
"prompt": "A futuristic cityscape",
|
120 |
+
"model": "black-forest-labs-flux-1-dev",
|
121 |
+
"width": 1024,
|
122 |
+
"height": 1024,
|
123 |
+
"guidance_scale": 3.5,
|
124 |
+
"seed": 0,
|
125 |
+
"provider": "blackforestlabs"
|
126 |
+
}
|
127 |
+
|
128 |
+
response = requests.post(url, json=data)
|
129 |
+
|
130 |
+
if response.status_code == 200:
|
131 |
+
print("Image URL:", response.json()["image_url"])
|
132 |
+
else:
|
133 |
+
print("Error:", response.json())</code></pre>
|
134 |
+
|
135 |
+
<div class="footer">
|
136 |
+
<p>π API v1.0 | Designed for developers</p>
|
137 |
+
</div>
|
138 |
+
</div>
|
139 |
+
</body>
|
140 |
+
</html>
|