Spaces:
Sleeping
Sleeping
<html> | |
<head> | |
<title>API Documentation</title> | |
<style> | |
body { | |
font-family: Arial, sans-serif; | |
padding: 20px; | |
} | |
h1 { | |
margin-bottom: 20px; | |
} | |
.endpoint { | |
margin-bottom: 30px; | |
} | |
.endpoint h3 { | |
margin-top: 0; | |
font-size: 1.2em; | |
font-weight: bold; | |
} | |
.method { | |
margin-bottom: 10px; | |
} | |
.code-block { | |
background-color: #f4f4f4; | |
padding: 10px; | |
font-family: monospace; | |
margin-bottom: 20px; | |
} | |
.code-block pre { | |
margin: 0; | |
} | |
.sample-code { | |
background-color: #f4f4f4; | |
padding: 10px; | |
margin-bottom: 20px; | |
} | |
.sample-code pre { | |
margin: 0; | |
overflow-x: auto; | |
} | |
.image-style { | |
width: 100px; | |
height: auto; | |
} | |
.style-info { | |
margin-top: 10px; | |
font-size: 0.8em; | |
color: #888; | |
} | |
</style> | |
<script> | |
document.addEventListener("DOMContentLoaded", function() { | |
const endpoints = document.querySelectorAll(".endpoint"); | |
endpoints.forEach(function(endpoint) { | |
const codeBlock = endpoint.querySelector(".code-block"); | |
const sampleCode = endpoint.querySelector(".sample-code"); | |
const showButton = document.createElement("button"); | |
showButton.textContent = "Show Example Code"; | |
showButton.addEventListener("click", function() { | |
codeBlock.style.display = "block"; | |
sampleCode.style.display = "block"; | |
showButton.style.display = "none"; | |
}); | |
endpoint.appendChild(showButton); | |
}); | |
}); | |
</script> | |
</head> | |
<body> | |
<h1>API Documentation</h1> | |
<div class="endpoint"> | |
<h3>Generate Image</h3> | |
<p class="method">Endpoint: <code>/api/generate</code></p> | |
<p class="method">Method: <code>POST</code></p> | |
<p class="method">Description: Generate an image based on the provided parameters.</p> | |
<div class="code-block" style="display: none;"> | |
<p>Request Payload:</p> | |
<pre> | |
{ | |
"prompt": "Woman sitting on a table, looking at the sky, seen from behind", | |
"style": "ANIME_V2", | |
"ratio": "RATIO_16X9", | |
"model": "REALISTIC" | |
} | |
</pre> | |
</div> | |
<div class="code-block" style="display: none;"> | |
<p>Response:</p> | |
<pre> | |
{ | |
"error": "An error occurred while generating the image." | |
} | |
</pre> | |
</div> | |
<div class="sample-code" style="display: none;"> | |
<p>Sample Code:</p> | |
<pre> | |
import requests | |
url = 'https://imseldrith-imagine.hf.space/api/generate' | |
headers = {'Content-Type':'application/json'} | |
payload = { | |
'prompt': "Woman sitting on a table, looking at the sky, seen from behind", | |
'style': 'ANIME_V2', | |
'ratio': 'RATIO_16X9', | |
'model': 'REALISTIC' | |
} | |
response = requests.post(url, json=payload) | |
if response.status_code == 200: | |
# Image generation successful | |
with open('generated_image.jpg', 'wb') as image_file: | |
image_file.write(response.content) | |
print('Image saved successfully!') | |
else: | |
# Error occurred during image generation | |
error_data = response.json() | |
error_message = error_data.get('error', 'Unknown error') | |
print(f'Failed to generate image: {error_message}') | |
</pre> | |
</div> | |
</div> | |
<div class="endpoint"> | |
<h3>Supported Ratios</h3> | |
<div class="style-info"> | |
<p><strong>RATIO_1X1:</strong> 1:1</p> | |
<p><strong>RATIO_4X3:</strong> 4:3</p> | |
<p><strong>RATIO_3X2:</strong> 3:2</p> | |
<p><strong>RATIO_2X3:</strong> 2:3</p> | |
<p><strong>RATIO_16X9:</strong> 16:9</p> | |
<p><strong>RATIO_9X16:</strong> 9:16</p> | |
<p><strong>RATIO_5X4:</strong> 5:4</p> | |
<p><strong>RATIO_4X5:</strong> 4:5</p> | |
<p><strong>RATIO_3X1:</strong> 3:1</p> | |
<p><strong>RATIO_3X4:</strong> 3:4</p> | |
</div> | |
</div> | |
<div class="endpoint"> | |
<h3>Supported Models</h3> | |
<div class="style-info"> | |
<p><strong>V4_BETA:</strong> V4(Beta)</p> | |
<p><strong>CREATIVE:</strong> Creative</p> | |
<p><strong>V3:</strong> V3</p> | |
<p><strong>V1:</strong> V1</p> | |
<p><strong>PORTRAIT:</strong> Portrait</p> | |
<p><strong>REALISTIC:</strong> Realistic</p> | |
<p><strong>ANIME:</strong> Anime</p> | |
</div> | |
</div> | |
<div class="endpoint"> | |
<h3>Supported Styles</h3> | |
<div class="style-info"> | |
<p><strong>NO_STYLE:</strong> No style</p> | |
<p><strong>EUPHORIC:</strong> Euphoric</p> | |
<p><strong>FANTASY:</strong> Fantasy</p> | |
<p><strong>CYBERPUNK:</strong> Cyberpunk</p> | |
<p><strong>STUDIO_GHIBLI:</strong> Studio Ghibli</p> | |
<p><strong>DISNEY:</strong> Disney</p> | |
<p><strong>GTA:</strong> GTA</p> | |
<p><strong>KAWAII_CHIBI:</strong> Kawaii Chibi</p> | |
<p><strong>ANIME_V2:</strong> Anime V2</p> | |
<p><strong>ABSTRACT_VIBRANT:</strong> Abstract Vibrant</p> | |
<p><strong>VIBRANT:</strong> Vibrant</p> | |
<p><strong>PSYCHEDELIC:</strong> Psychedelic</p> | |
<p><strong>EXTRA_TERRESTRIAL:</strong> Extra-terrestrial</p> | |
<p><strong>COSMIC:</strong> Cosmic</p> | |
<p><strong>MACRO_PHOTOGRAPHY:</strong> Macro Photography</p> | |
<p><strong>PRODUCT_PHOTOGRAPHY:</strong> Product Photography</p> | |
<p><strong>POLAROID:</strong> Polaroid</p> | |
<p><strong>NEO_FAUVISM:</strong> Neo fauvism</p> | |
<p><strong>POP_ART:</strong> Pop Art</p> | |
<p><strong>POP_ART_II:</strong> Pop Art II</p> | |
<p><strong>GRAFFITI:</strong> Graffiti</p> | |
<p><strong>SURREALISM:</strong> Surrealism</p> | |
<p><strong>BAUHAUS:</strong> Bauhaus</p> | |
</div> | |
</div> | |
</body> | |
</html> |