ngoctuanai commited on
Commit
544b4ee
1 Parent(s): 7134d92

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +130 -119
app.py CHANGED
@@ -79,125 +79,136 @@ def generate_txt2img(current_model, prompt, is_negative=False, image_style="None
79
 
80
 
81
  css = """
82
- .gradio-container {
83
- font-family: 'IBM Plex Sans', sans-serif;
84
- }
85
- .gr-button {
86
- color: white;
87
- border-color: black;
88
- background: black;
89
- }
90
- input[type='range'] {
91
- accent-color: black;
92
- }
93
- .dark input[type='range'] {
94
- accent-color: #dfdfdf;
95
- }
96
- .gradio-container {
97
- max-width: 730px !important;
98
- margin: auto;
99
- padding-top: 1.5rem;
100
- }
101
- #gallery {
102
- min-height: 22rem;
103
- margin-bottom: 15px;
104
- margin-left: auto;
105
- margin-right: auto;
106
- border-bottom-right-radius: .5rem !important;
107
- border-bottom-left-radius: .5rem !important;
108
- }
109
- #gallery>div>.h-full {
110
- min-height: 20rem;
111
- }
112
- .details:hover {
113
- text-decoration: underline;
114
- }
115
- .gr-button {
116
- white-space: nowrap;
117
- }
118
- .gr-button:focus {
119
- border-color: rgb(147 197 253 / var(--tw-border-opacity));
120
- outline: none;
121
- box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
122
- --tw-border-opacity: 1;
123
- --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
124
- --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px var(--tw-ring-offset-width)) var(--tw-ring-color);
125
- --tw-ring-color: rgb(191 219 254 / var(--tw-ring-opacity));
126
- --tw-ring-opacity: .5;
127
- }
128
- #advanced-btn {
129
- font-size: .7rem !important;
130
- line-height: 19px;
131
- margin-top: 12px;
132
- margin-bottom: 12px;
133
- padding: 2px 8px;
134
- border-radius: 14px !important;
135
- }
136
- #advanced-options {
137
- display: none;
138
- margin-bottom: 20px;
139
- }
140
- .footer {
141
- margin-bottom: 45px;
142
- margin-top: 35px;
143
- text-align: center;
144
- border-bottom: 1px solid #e5e5e5;
145
- }
146
- .footer>p {
147
- font-size: .8rem;
148
- display: inline-block;
149
- padding: 0 10px;
150
- transform: translateY(10px);
151
- background: white;
152
- }
153
- .dark .footer {
154
- border-color: #303030;
155
- }
156
- .dark .footer>p {
157
- background: #0b0f19;
158
- }
159
- .acknowledgments h4{
160
- margin: 1.25em 0 .25em 0;
161
- font-weight: bold;
162
- font-size: 115%;
163
- }
164
- .animate-spin {
165
- animation: spin 1s linear infinite;
166
- }
167
- @keyframes spin {
168
- from {
169
- transform: rotate(0deg);
170
- }
171
- to {
172
- transform: rotate(360deg);
173
- }
174
- }
175
- #share-btn-container {padding-left: 0.5rem !important; padding-right: 0.5rem !important; background-color: #000000; justify-content: center; align-items: center; border-radius: 9999px !important; max-width: 13rem; margin-left: auto;}
176
- div#share-btn-container > div {flex-direction: row;background: black;align-items: center}
177
- #share-btn-container:hover {background-color: #060606}
178
- #share-btn {all: initial; color: #ffffff;font-weight: 600; cursor:pointer; font-family: 'IBM Plex Sans', sans-serif; margin-left: 0.5rem !important; padding-top: 0.5rem !important; padding-bottom: 0.5rem !important;right:0;}
179
- #share-btn * {all: unset}
180
- #share-btn-container div:nth-child(-n+2){width: auto !important;min-height: 0px !important;}
181
- #share-btn-container .wrap {display: none !important}
182
- #share-btn-container.hidden {display: none!important}
183
- .gr-form{
184
- flex: 1 1 50%; border-top-right-radius: 0; border-bottom-right-radius: 0;
185
- }
186
- #prompt-container{
187
- gap: 0;
188
- }
189
- #prompt-container .form{
190
- border-top-right-radius: 0;
191
- border-bottom-right-radius: 0;
192
- }
193
- #gen-button{
194
- border-top-left-radius:0;
195
- border-bottom-left-radius:0;
196
- }
197
- #prompt-text-input, #negative-prompt-text-input{padding: .45rem 0.625rem}
198
- #component-16{border-top-width: 1px!important;margin-top: 1em}
199
- .image_duplication{position: absolute; width: 100px; left: 50px}
200
- .tabitem{border: 0 !important}
 
 
 
 
 
 
 
 
 
 
 
201
  """
202
 
203
  with gr.Blocks(css=css) as demo:
 
79
 
80
 
81
  css = """
82
+ /* Ensure responsive design for different screen sizes */
83
+ @media only screen and (max-width: 768px) {
84
+ .gradio-container {
85
+ max-width: 100% !important;
86
+ }
87
+ }
88
+
89
+ /* Improve button style for better visibility */
90
+ .gr-button {
91
+ color: white;
92
+ background: black;
93
+ border-color: black;
94
+ border-radius: 5px; /* Add border-radius for a more modern look */
95
+ }
96
+
97
+ /* Adjust range input style for better visibility */
98
+ input[type='range'] {
99
+ accent-color: black;
100
+ width: 100%; /* Ensure the range input spans the entire width */
101
+ }
102
+
103
+ /* Increase spacing and improve layout for the gallery section */
104
+ #gallery {
105
+ min-height: 20rem; /* Adjust min-height for better responsiveness */
106
+ margin: 15px auto; /* Center the gallery */
107
+ border-radius: 0.5rem; /* Add border-radius for a smoother appearance */
108
+ }
109
+
110
+ /* Enhance hover effect for details */
111
+ .details:hover {
112
+ text-decoration: underline;
113
+ }
114
+
115
+ /* Improve readability and style for the footer */
116
+ .footer {
117
+ margin: 35px 0 45px;
118
+ text-align: center;
119
+ border-bottom: 1px solid #e5e5e5;
120
+ background: white; /* Add background color for better contrast */
121
+ }
122
+
123
+ /* Adjust padding and border color for the advanced options button */
124
+ #advanced-btn {
125
+ font-size: 0.9rem;
126
+ line-height: 24px;
127
+ margin: 12px 0;
128
+ padding: 6px 12px; /* Increase padding for a more comfortable click area */
129
+ border-radius: 14px;
130
+ border-color: black; /* Match border color with button color */
131
+ }
132
+
133
+ /* Improve styling for acknowledgments section */
134
+ .acknowledgments h4 {
135
+ margin: 1.25em 0 0.25em;
136
+ font-weight: bold;
137
+ font-size: 1.15rem;
138
+ }
139
+
140
+ /* Add a subtle animation to the spin class */
141
+ .animate-spin {
142
+ animation: spin 1s linear infinite;
143
+ }
144
+
145
+ /* Adjust share button styling for better visibility */
146
+ #share-btn-container {
147
+ padding: 0.5rem !important;
148
+ background-color: #000000;
149
+ justify-content: center;
150
+ align-items: center;
151
+ border-radius: 9999px;
152
+ max-width: 13rem;
153
+ margin: 0 auto;
154
+ }
155
+
156
+ #share-btn-container:hover {
157
+ background-color: #060606;
158
+ }
159
+
160
+ #share-btn {
161
+ color: #ffffff;
162
+ font-weight: 600;
163
+ cursor: pointer;
164
+ font-family: 'IBM Plex Sans', sans-serif;
165
+ margin-left: 0.5rem !important;
166
+ padding: 0.5rem !important;
167
+ right: 0;
168
+ }
169
+
170
+ /* Adjust form and button styling for better alignment */
171
+ .gr-form {
172
+ flex: 1 1 100%; /* Use full width for better responsiveness */
173
+ border-radius: 5px; /* Add border-radius for a smoother appearance */
174
+ }
175
+
176
+ #prompt-container {
177
+ gap: 0;
178
+ }
179
+
180
+ #prompt-container .form {
181
+ border-radius: 5px; /* Add border-radius for a smoother appearance */
182
+ }
183
+
184
+ #gen-button {
185
+ border-radius: 5px; /* Add border-radius for a smoother appearance */
186
+ }
187
+
188
+ /* Improve styling for input text boxes */
189
+ #prompt-text-input, #negative-prompt-text-input {
190
+ padding: 0.45rem 0.625rem;
191
+ }
192
+
193
+ /* Ensure a minimum width for component-16 */
194
+ #component-16 {
195
+ border-top-width: 1px !important;
196
+ margin-top: 1em;
197
+ min-width: 200px; /* Add a minimum width for better visibility */
198
+ }
199
+
200
+ /* Improve styling for image duplication */
201
+ .image_duplication {
202
+ position: absolute;
203
+ width: 100px;
204
+ left: 50px;
205
+ border-radius: 50%; /* Make the image circular */
206
+ }
207
+
208
+ /* Remove unnecessary border for tab items */
209
+ .tabitem {
210
+ border: none !important;
211
+ }
212
  """
213
 
214
  with gr.Blocks(css=css) as demo: