Spaces:
Running
Running
Upload folder using huggingface_hub
Browse files- auto_diffusers.log +0 -0
- gradio_app.py +90 -3
auto_diffusers.log
CHANGED
The diff for this file is too large to render.
See raw diff
|
|
gradio_app.py
CHANGED
@@ -521,13 +521,67 @@ def create_gradio_interface():
|
|
521 |
overflow: hidden !important;
|
522 |
}
|
523 |
|
524 |
-
/*
|
525 |
-
.code-container
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
526 |
background: #ffffff !important;
|
|
|
527 |
border-radius: 4px !important;
|
528 |
font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Fira Code', monospace !important;
|
529 |
font-size: 14px !important;
|
530 |
line-height: 1.5 !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
531 |
}
|
532 |
|
533 |
/* Enable soft wrapping for code content */
|
@@ -694,6 +748,38 @@ def create_gradio_interface():
|
|
694 |
[role="listbox"][style*="background"] {
|
695 |
background: #ffffff !important;
|
696 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
697 |
|
698 |
/* Accordion title styling - target the actual Gradio accordion elements */
|
699 |
button.label-wrap > span:first-child,
|
@@ -1034,7 +1120,7 @@ def create_gradio_interface():
|
|
1034 |
elem_classes="view-prompt-btn"
|
1035 |
)
|
1036 |
|
1037 |
-
# Code Output
|
1038 |
code_output = gr.Code(
|
1039 |
label="Generated Code",
|
1040 |
language="python",
|
@@ -1043,6 +1129,7 @@ def create_gradio_interface():
|
|
1043 |
show_label=True,
|
1044 |
elem_classes="code-container",
|
1045 |
show_line_numbers=False,
|
|
|
1046 |
value="# Your optimized diffusion code will appear here after generation\n# Click 'Generate Optimized Code' to create hardware-specific Python code\n\nprint('Ready to generate AI art with optimized performance!')"
|
1047 |
)
|
1048 |
|
|
|
521 |
overflow: hidden !important;
|
522 |
}
|
523 |
|
524 |
+
/* Force text selection on ALL code elements */
|
525 |
+
.code-container,
|
526 |
+
.code-container *,
|
527 |
+
.code-container textarea,
|
528 |
+
.code-container input,
|
529 |
+
.code-container .cm-editor,
|
530 |
+
.code-container .cm-content,
|
531 |
+
.code-container .cm-line {
|
532 |
+
user-select: text !important;
|
533 |
+
-webkit-user-select: text !important;
|
534 |
+
-moz-user-select: text !important;
|
535 |
+
-ms-user-select: text !important;
|
536 |
+
cursor: text !important;
|
537 |
+
}
|
538 |
+
|
539 |
+
/* Make selection visible */
|
540 |
+
.code-container .cm-editor ::selection {
|
541 |
+
background: #3b82f6 !important;
|
542 |
+
color: white !important;
|
543 |
+
}
|
544 |
+
|
545 |
+
.code-container .cm-editor ::-moz-selection {
|
546 |
+
background: #3b82f6 !important;
|
547 |
+
color: white !important;
|
548 |
+
}
|
549 |
+
|
550 |
+
/* Make cursor visible */
|
551 |
+
.code-container .cm-cursor {
|
552 |
+
border-color: #3b82f6 !important;
|
553 |
+
border-width: 2px !important;
|
554 |
+
opacity: 1 !important;
|
555 |
+
visibility: visible !important;
|
556 |
+
}
|
557 |
+
|
558 |
+
/* Ensure selection works in CodeMirror */
|
559 |
+
.code-container .cm-selectionBackground {
|
560 |
+
background: #3b82f6 !important;
|
561 |
+
opacity: 0.3 !important;
|
562 |
+
}
|
563 |
+
|
564 |
+
/* Make sure focused state is visible */
|
565 |
+
.code-container .cm-focused {
|
566 |
+
outline: 2px solid #3b82f6 !important;
|
567 |
+
outline-offset: 2px !important;
|
568 |
+
}
|
569 |
+
|
570 |
+
/* Code textbox styling */
|
571 |
+
.code-container textarea {
|
572 |
background: #ffffff !important;
|
573 |
+
border: none !important;
|
574 |
border-radius: 4px !important;
|
575 |
font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Fira Code', monospace !important;
|
576 |
font-size: 14px !important;
|
577 |
line-height: 1.5 !important;
|
578 |
+
padding: 1.5rem !important;
|
579 |
+
color: #2d3748 !important;
|
580 |
+
font-weight: 500 !important;
|
581 |
+
resize: vertical !important;
|
582 |
+
white-space: pre !important;
|
583 |
+
overflow-wrap: normal !important;
|
584 |
+
word-break: normal !important;
|
585 |
}
|
586 |
|
587 |
/* Enable soft wrapping for code content */
|
|
|
748 |
[role="listbox"][style*="background"] {
|
749 |
background: #ffffff !important;
|
750 |
}
|
751 |
+
</script>
|
752 |
+
|
753 |
+
<script>
|
754 |
+
// Fix CodeMirror text selection after page loads
|
755 |
+
document.addEventListener('DOMContentLoaded', function() {
|
756 |
+
setTimeout(function() {
|
757 |
+
// Find all CodeMirror editors
|
758 |
+
const editors = document.querySelectorAll('.code-container .cm-editor');
|
759 |
+
editors.forEach(editor => {
|
760 |
+
// Enable text selection on CodeMirror
|
761 |
+
editor.style.userSelect = 'text';
|
762 |
+
editor.style.webkitUserSelect = 'text';
|
763 |
+
editor.style.mozUserSelect = 'text';
|
764 |
+
|
765 |
+
// Find the content area
|
766 |
+
const content = editor.querySelector('.cm-content');
|
767 |
+
if (content) {
|
768 |
+
content.style.userSelect = 'text';
|
769 |
+
content.style.webkitUserSelect = 'text';
|
770 |
+
content.style.mozUserSelect = 'text';
|
771 |
+
}
|
772 |
+
|
773 |
+
// Add event listeners to ensure selection works
|
774 |
+
editor.addEventListener('mousedown', function(e) {
|
775 |
+
e.stopPropagation();
|
776 |
+
});
|
777 |
+
});
|
778 |
+
}, 1000);
|
779 |
+
});
|
780 |
+
</script>
|
781 |
+
|
782 |
+
<style>
|
783 |
|
784 |
/* Accordion title styling - target the actual Gradio accordion elements */
|
785 |
button.label-wrap > span:first-child,
|
|
|
1120 |
elem_classes="view-prompt-btn"
|
1121 |
)
|
1122 |
|
1123 |
+
# Code Output - back to Code component with better selection
|
1124 |
code_output = gr.Code(
|
1125 |
label="Generated Code",
|
1126 |
language="python",
|
|
|
1129 |
show_label=True,
|
1130 |
elem_classes="code-container",
|
1131 |
show_line_numbers=False,
|
1132 |
+
wrap_lines=True,
|
1133 |
value="# Your optimized diffusion code will appear here after generation\n# Click 'Generate Optimized Code' to create hardware-specific Python code\n\nprint('Ready to generate AI art with optimized performance!')"
|
1134 |
)
|
1135 |
|