Spaces:
Running
Running
File size: 6,196 Bytes
a85af88 93c230a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.24.1/themes/prism.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.2.0/styles/default.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.2.0/highlight.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.2.0/languages/python.min.js"></script>
<title>SDXL API</title>
<style>
/* Add your CSS styling here */
body {
font-family: Arial, sans-serif;
background-color: rgb(0,0,15);
color: white;
}
.code-container {
background-color: #000; /* Change the background color to black */
padding: 20px;
border-radius: 5px;
border: 1px solid #ccc;
margin-bottom: 20px;
overflow-x: auto; /* Enable horizontal scroll */
}
label {
display: block;
margin-bottom: 5px;
background-color: rgb(0,0,15);
color: white;
}
input[type="text"],
input[type="number"],
select {
width: 100%;
padding: 8px;
margin-bottom: 10px;
border: 1px solid #000000;
border-radius: 4px;
background-color: rgb(0,0,15);
box-sizing: border-box;
color: white;
border: 1px solid rgb(250, 4, 188);
width: 50%;
}
button {
background-color: #4CAF50;
color: white;
padding: 10px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
}
button:hover {
background-color: #45a049;
}
#response {
margin-top: 20px;
border: 1px solid #0a0a0a;
padding: 10px;
border-radius: 4px;
}
p{
color: rgb(255, 0, 0);
}
.token keyword{
background-color: #000;
}
</style>
</head>
<body>
<h2>FREE SDXL API!</h2>
<a href="https://discord.gg/whhTdtPfKc" target="_blank" style="color: blue">Join Discord for any Support or Assistance </a> <br>
<a href="https://buymeacoffee.com/mygx" target="_blank" style="color: blue"> Buy me Coffee 💵 </a>
<p>Scroll down for api code example</p>
<p>RateLimit: 100 requests per minute</p>
<form id="apiForm">
<label for="prompt">Prompt:</label>
<input type="text" id="prompt" name="prompt" value="car">
<label for="apply_watermark">Apply Watermark:</label>
<select id="apply_watermark" name="apply_watermark">
<option value="true">True</option>
<option value="false">False</option>
</select>
<label for="width">Width:</label>
<input type="number" id="width" name="width" value="1024">
<label for="height">Height:</label>
<input type="number" id="height" name="height" value="1024">
<label for="num_outputs">Number of Outputs:</label>
<input type="number" id="num_outputs" name="num_outputs" value="1">
<label for="scheduler">Scheduler:</label>
<input type="text" id="scheduler" name="scheduler" value="DDIM">
<label for="num_inference_steps">Number of Inference Steps:</label>
<input type="number" id="num_inference_steps" name="num_inference_steps" value="40">
<label for="guidance_scale">Guidance Scale:</label>
<input type="number" id="guidance_scale" name="guidance_scale" value="8">
<label for="prompt_strength">Prompt Strength:</label>
<input type="number" id="prompt_strength" name="prompt_strength" value="0.8">
<label for="seed">Seed:</label>
<input type="number" id="seed" name="seed" value="69">
<label for="refine">Refine:</label>
<input type="text" id="refine" name="refine" value="no_refiner">
<label for="high_noise_frac">High Noise Fraction:</label>
<input type="number" id="high_noise_frac" name="high_noise_frac" value="1">
<!-- Add more input fields for other parameters -->
<button type="submit" id="submitButton">Submit</button>
<p id="loadingText" style="display: none;">Generating image...</p>
</form>
<div id="response"></div>
<div class="code-container">
<pre><code id="codeBlock" class="language-python">
import requests
url = 'https://fumes-api.onrender.com/sdxl-api'
payload = {'prompt': 'car',
"apply_watermark": False,
"negative_prompt": '',
"image": None,
"mask": None,
"width": 1024,
"height": 1024,
"num_outputs": 1,
"scheduler": 'DDIM',
"num_inference_steps": 40,
"guidance_scale": 8,
"prompt_strength": 0.8,
"seed": 69,
"refine": "no_refiner",
"high_noise_frac": 1,
"refine_steps": None,}
response = requests.post(url, json=payload)
print(response.json())
</code></pre>
</div>
<!-- Include Prism.js library -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.24.1/prism.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.24.1/components/prism-python.min.js"></script>
<script>
document.getElementById("apiForm").addEventListener("submit", function(event) {
event.preventDefault();
var formData = new FormData(this);
var submitButton = document.getElementById("submitButton");
var loadingText = document.getElementById("loadingText");
submitButton.disabled = true;
loadingText.style.display = "block";
fetch('https://fumes-api.onrender.com/sdxl-api', {
method: 'POST',
body: JSON.stringify(Object.fromEntries(formData)),
headers: {
'Content-Type': 'application/json'
}
})
.then(response => response.json())
.then(data => {
document.getElementById("response").innerText = JSON.stringify(data.output, null, 2);
submitButton.disabled = false;
loadingText.style.display = "none";
})
.catch(error => {
console.error('Error:', error);
submitButton.disabled = false;
loadingText.style.display = "none";
});
});
</script>
</body>
</html>
|