dalle-test.html•5.36 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>DALL-E API Test</title>
<style>
body {
font-family: Arial, sans-serif;
line-height: 1.6;
max-width: 1200px;
margin: 0 auto;
padding: 20px;
color: #333;
}
h1 {
color: #2c3e50;
border-bottom: 2px solid #3498db;
padding-bottom: 10px;
}
h2 {
color: #2980b9;
margin-top: 30px;
}
pre {
background-color: #f8f9fa;
border: 1px solid #ddd;
border-radius: 4px;
padding: 15px;
overflow-x: auto;
}
code {
font-family: 'Courier New', Courier, monospace;
}
.option {
margin-bottom: 20px;
padding: 15px;
background-color: #f8f9fa;
border-radius: 4px;
border-left: 4px solid #3498db;
}
.option h3 {
margin-top: 0;
color: #2980b9;
}
#image-display {
margin-top: 30px;
text-align: center;
}
#image-display img {
max-width: 100%;
border-radius: 8px;
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
.instructions {
background-color: #e8f4f8;
padding: 15px;
border-radius: 4px;
margin-top: 30px;
}
table {
width: 100%;
border-collapse: collapse;
margin: 20px 0;
}
th, td {
padding: 12px 15px;
text-align: left;
border-bottom: 1px solid #ddd;
}
th {
background-color: #f2f2f2;
}
tr:hover {
background-color: #f5f5f5;
}
</style>
</head>
<body>
<h1>DALL-E API Test</h1>
<div class="instructions">
<h2>Instructions</h2>
<p>This page is designed to display and test DALL-E generated images. To use it:</p>
<ol>
<li>Run the test-dalle.js script with your OpenAI API key</li>
<li>Copy the image URL from the console output</li>
<li>Open your browser's console (F12 or right-click > Inspect > Console)</li>
<li>Run the following code in the console, replacing the URL with your image URL:</li>
</ol>
<pre><code>const imageUrl = "https://your-dalle-image-url-here.png";
document.getElementById('image-display').innerHTML = `<img src="${imageUrl}" alt="DALL-E Generated Image">`;</code></pre>
</div>
<h2>DALL-E API Options</h2>
<p>The DALL-E API supports various options to customize the image generation process. Here's a comprehensive list of available options:</p>
<table>
<tr>
<th>Parameter</th>
<th>Description</th>
<th>Values</th>
</tr>
<tr>
<td>model</td>
<td>The DALL-E model to use</td>
<td>dall-e-2, dall-e-3</td>
</tr>
<tr>
<td>prompt</td>
<td>Text description of the desired image</td>
<td>String (max 1000 characters)</td>
</tr>
<tr>
<td>n</td>
<td>Number of images to generate</td>
<td>1-10 (DALL-E 2), 1 (DALL-E 3)</td>
</tr>
<tr>
<td>size</td>
<td>Size of the generated image</td>
<td>256x256, 512x512, 1024x1024 (all models)<br>1792x1024, 1024x1792 (DALL-E 3 only)</td>
</tr>
<tr>
<td>quality</td>
<td>Quality of the generated image</td>
<td>standard, hd (DALL-E 3 only)</td>
</tr>
<tr>
<td>style</td>
<td>Style of the generated image</td>
<td>vivid, natural (DALL-E 3 only)</td>
</tr>
<tr>
<td>response_format</td>
<td>Format of the response</td>
<td>url, b64_json</td>
</tr>
</table>
<h2>Example Configurations</h2>
<div class="option">
<h3>Default</h3>
<pre><code>{
prompt: "A cat wearing a hat"
}</code></pre>
<p>Uses all default settings: DALL-E 3, 1024x1024, standard quality, vivid style.</p>
</div>
<div class="option">
<h3>HD Quality</h3>
<pre><code>{
prompt: "A scenic mountain landscape at sunset",
quality: "hd",
size: "1024x1024"
}</code></pre>
<p>Uses HD quality for more detailed images (DALL-E 3 only).</p>
</div>
<div class="option">
<h3>Natural Style</h3>
<pre><code>{
prompt: "A futuristic city with flying cars",
style: "natural"
}</code></pre>
<p>Uses natural style for more photorealistic images (DALL-E 3 only).</p>
</div>
<div class="option">
<h3>Wide Format</h3>
<pre><code>{
prompt: "A panoramic view of a beach at sunrise",
size: "1792x1024"
}</code></pre>
<p>Uses wide format for landscape-oriented images (DALL-E 3 only).</p>
</div>
<div class="option">
<h3>Tall Format</h3>
<pre><code>{
prompt: "A tall skyscraper reaching into the clouds",
size: "1024x1792"
}</code></pre>
<p>Uses tall format for portrait-oriented images (DALL-E 3 only).</p>
</div>
<h2>Generated Image</h2>
<div id="image-display">
<p>No image generated yet. Run the test script and paste the image URL in the console.</p>
</div>
<script>
// This script will be used to display the generated image
console.log('DALL-E Test Page Loaded');
console.log('To display an image, run the following code in the console:');
console.log('const imageUrl = "https://your-dalle-image-url-here.png";');
console.log('document.getElementById(\'image-display\').innerHTML = `<img src="${imageUrl}" alt="DALL-E Generated Image">`;');
</script>
</body>
</html>