| css = ''' | |
| .loader-container { | |
| display: flex; /* Use flex to align items horizontally */ | |
| align-items: center; /* Center items vertically within the container */ | |
| white-space: nowrap; /* Prevent line breaks within the container */ | |
| } | |
| .loader { | |
| border: 8px solid #f3f3f3; /* Light grey */ | |
| border-top: 8px solid #3498db; /* Blue */ | |
| border-radius: 50%; | |
| width: 20px; | |
| height: 20px; | |
| animation: spin 2s linear infinite; | |
| } | |
| @keyframes spin { | |
| 0% { transform: rotate(0deg); } | |
| 100% { transform: rotate(360deg); } | |
| } | |
| /* Style the progress bar */ | |
| progress { | |
| appearance: none; /* Remove default styling */ | |
| height: 15px; /* Set the height of the progress bar */ | |
| border-radius: 5px; /* Round the corners of the progress bar */ | |
| background-color: #f3f3f3; /* Light grey background */ | |
| width: 100%; | |
| margin-top: 5px; | |
| } | |
| /* Style the progress bar container */ | |
| .progress-container { | |
| margin-left: 5px; | |
| margin-right: 5px; | |
| flex-grow: 1; /* Allow the progress container to take up remaining space */ | |
| } | |
| /* Set the color of the progress bar fill */ | |
| progress::-webkit-progress-value { | |
| background-color: #3498db; /* Blue color for the fill */ | |
| } | |
| progress::-moz-progress-bar { | |
| background-color: #3498db; /* Blue color for the fill in Firefox */ | |
| } | |
| /* Style the text on the progress bar */ | |
| progress::after { | |
| content: attr(value '%'); /* Display the progress value followed by '%' */ | |
| position: absolute; | |
| top: 50%; | |
| left: 50%; | |
| transform: translate(-50%, -50%); | |
| color: white; /* Set text color */ | |
| font-size: 12px; /* Set font size */ | |
| } | |
| /* Style other texts */ | |
| .loader-container > span { | |
| margin-left: 5px; /* Add spacing between the progress bar and the text */ | |
| } | |
| .progress-bar > .generating { | |
| display: none !important; | |
| } | |
| #progress-bar { | |
| height: 22px !important; | |
| } | |
| .stylebox{ | |
| min-height: 110px !important; | |
| } | |
| #generate-button { | |
| height: 60px !important; | |
| white-space: pre-line !important; | |
| } | |
| #style-selection input { | |
| min-height: 39px !important; | |
| } | |
| .stylebox label span { | |
| margin-bottom: 22px !important; | |
| } | |
| .scroll-hide { | |
| resize: none !important; | |
| } | |
| .input-label h5 { | |
| margin: 0 !important; | |
| padding-top: 3px !important; | |
| } | |
| .icon-buttons > a > button > div, .icon-buttons > button > div { | |
| width: 2em; | |
| height: 2em; | |
| } | |
| .stretch { | |
| column-gap: 0 !important; | |
| } | |
| .gap { | |
| row-gap: 6px !important; | |
| } | |
| .gallery { | |
| row-gap: 2px !important; | |
| } | |
| #prompt-examples .label, #greet-examples .label { | |
| display: none; | |
| } | |
| #prompt-examples > .gallery::before, #greet-examples > .gallery::before { | |
| content: "Examples"; | |
| font-size: 1.05em; | |
| font-weight: var(--prose-header-text-weight); | |
| padding-top: 0.33em; | |
| } | |
| #toggle-greet-checkbox span { | |
| font-size: 1.05em !important; | |
| font-weight: var(--prose-header-text-weight) !important; | |
| } | |
| .panel-container { | |
| box-shadow: var(--block-shadow); | |
| border: var(--block-border-width) solid var(--border-color-primary); | |
| border-radius: var(--block-radius); | |
| padding: 5px; | |
| max-width: 1280px; | |
| margin-bottom: 10px !important; | |
| } | |
| .label-wrap { | |
| justify-content: start !important; | |
| margin-bottom: 0 !important; | |
| } | |
| .label-wrap .icon { | |
| padding-top: 5px !important; | |
| } | |
| .label-wrap span{ | |
| font-size: 1.05em !important; | |
| font-weight: var(--prose-header-text-weight) !important; | |
| padding-right: 5px; | |
| } | |
| .generated-image img { | |
| width: 1280px !important; | |
| margin-bottom: -6px !important; | |
| } | |
| ''' | |
| progress_html = ''' | |
| <div class="loader-container" style="visibility:*visibility*;max-width:1280px;"> | |
| <div class="loader"></div> | |
| <div class="progress-container"> | |
| <progress value="*number*" max="100"></progress> | |
| </div> | |
| <span>*text*</span> | |
| </div> | |
| ''' | |
| def make_progress_html(number, text): | |
| return progress_html.replace('*number*', str(number)).replace('*text*', text).replace("*visibility*", "visible" if number >= 0 else "hidden") | |