Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -14,6 +14,7 @@ from datetime import datetime
|
|
| 14 |
import sqlite3
|
| 15 |
from datetime import datetime
|
| 16 |
|
|
|
|
| 17 |
# Initialize the database
|
| 18 |
def init_db(file='logs.db'):
|
| 19 |
conn = sqlite3.connect(file)
|
|
@@ -215,6 +216,39 @@ def query(prompt, is_negative=False, steps=30, cfg_scale=7, sampler="DPM++ 2M Ka
|
|
| 215 |
print(f"Error when trying to open the image: {e}")
|
| 216 |
return None, None, None
|
| 217 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 218 |
css = """
|
| 219 |
.gradio-container {
|
| 220 |
background: url(https://huggingface.co/spaces/K00B404/FLUX.1-Dev-Serverless-darn-enhanced-prompt/resolve/main/edge.png);
|
|
@@ -284,13 +318,8 @@ css = """
|
|
| 284 |
|
| 285 |
|
| 286 |
with gr.Blocks(theme='Nymbo/Nymbo_Theme', css=css) as app:
|
| 287 |
-
|
| 288 |
-
|
| 289 |
-
<div id="title-container">
|
| 290 |
-
<h1 id="title-text">FLUX Capacitor</h1>
|
| 291 |
-
</div>
|
| 292 |
-
</center>
|
| 293 |
-
""")
|
| 294 |
|
| 295 |
with gr.Column(elem_id="app-container"):
|
| 296 |
with gr.Row():
|
|
|
|
| 14 |
import sqlite3
|
| 15 |
from datetime import datetime
|
| 16 |
|
| 17 |
+
|
| 18 |
# Initialize the database
|
| 19 |
def init_db(file='logs.db'):
|
| 20 |
conn = sqlite3.connect(file)
|
|
|
|
| 216 |
print(f"Error when trying to open the image: {e}")
|
| 217 |
return None, None, None
|
| 218 |
|
| 219 |
+
js_code = """
|
| 220 |
+
<script>
|
| 221 |
+
document.addEventListener("DOMContentLoaded", function() {
|
| 222 |
+
const accordion = document.querySelector('.gr-accordion'); // Adjust selector based on accordion class
|
| 223 |
+
const container = document.querySelector('.gradio-container');
|
| 224 |
+
|
| 225 |
+
function adjustBackground() {
|
| 226 |
+
if (accordion && accordion.hasAttribute('open')) {
|
| 227 |
+
container.style.backgroundSize = '900px 2100px'; // When accordion is open
|
| 228 |
+
} else {
|
| 229 |
+
container.style.backgroundSize = '900px 880px'; // When accordion is closed
|
| 230 |
+
}
|
| 231 |
+
}
|
| 232 |
+
|
| 233 |
+
// Attach event listener to the accordion toggle
|
| 234 |
+
accordion.addEventListener('click', function() {
|
| 235 |
+
setTimeout(adjustBackground, 100); // Delay to allow accordion to fully open/close
|
| 236 |
+
});
|
| 237 |
+
|
| 238 |
+
// Initial background size based on initial state
|
| 239 |
+
adjustBackground();
|
| 240 |
+
});
|
| 241 |
+
</script>
|
| 242 |
+
"""
|
| 243 |
+
|
| 244 |
+
title_html="""
|
| 245 |
+
<center>
|
| 246 |
+
<div id="title-container">
|
| 247 |
+
<h1 id="title-text">FLUX Capacitor</h1>
|
| 248 |
+
</div>
|
| 249 |
+
</center>
|
| 250 |
+
"""
|
| 251 |
+
|
| 252 |
css = """
|
| 253 |
.gradio-container {
|
| 254 |
background: url(https://huggingface.co/spaces/K00B404/FLUX.1-Dev-Serverless-darn-enhanced-prompt/resolve/main/edge.png);
|
|
|
|
| 318 |
|
| 319 |
|
| 320 |
with gr.Blocks(theme='Nymbo/Nymbo_Theme', css=css) as app:
|
| 321 |
+
|
| 322 |
+
gr.HTML(title_html + js_code) # title html and stretch background script
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 323 |
|
| 324 |
with gr.Column(elem_id="app-container"):
|
| 325 |
with gr.Row():
|