ngoctuanai commited on
Commit
a236b79
·
1 Parent(s): 11b5377

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +44 -65
app.py CHANGED
@@ -81,90 +81,67 @@ css = """
81
  /* General Container Styles */
82
  .gradio-container {
83
  font-family: 'IBM Plex Sans', sans-serif;
84
- max-width: 730px !important;
85
  margin: auto;
86
- padding-top: 1.5rem;
87
  }
88
 
89
  /* Button Styles */
90
- .gr-button {
91
- color: white;
92
- border-color: black;
93
- background: black;
94
- white-space: nowrap;
95
  }
96
 
97
- .gr-button:focus {
98
- border-color: rgb(147 197 253 / var(--tw-border-opacity));
99
- outline: none;
100
- box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
101
- --tw-border-opacity: 1;
102
- --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
103
- --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px var(--tw-ring-offset-width)) var(--tw-ring-color);
104
- --tw-ring-color: rgb(191 219 254 / var(--tw-ring-opacity));
105
- --tw-ring-opacity: .5;
106
  }
107
 
108
- /* Footer Styles */
109
- .footer, .dark .footer {
110
- margin-bottom: 45px;
111
- margin-top: 35px;
112
- text-align: center;
113
  }
114
 
115
- .footer > p, .dark .footer > p {
116
- font-size: .8rem;
117
- display: inline-block;
118
- padding: 0 10px;
119
- transform: translateY(10px);
120
- background: white;
121
  }
122
 
123
- /* Share Button Styles */
124
- #share-btn-container {
125
- padding: 0 0.5rem !important;
126
- background-color: #000000;
127
- justify-content: center;
128
- align-items: center;
129
- border-radius: 9999px !important;
130
- max-width: 13rem;
131
- margin-left: auto;
132
  }
133
 
134
- #share-btn-container:hover {
135
- background-color: #060606;
 
 
 
136
  }
137
 
138
- #share-btn {
139
- all: initial;
140
- color: #ffffff;
141
- font-weight: 600;
142
- cursor: pointer;
143
- font-family: 'IBM Plex Sans', sans-serif;
144
- margin-left: 0.5rem !important;
145
- padding: 0.5rem !important;
146
- right: 0;
147
  }
148
 
149
- /* Animation Styles */
150
- .animate-spin {
151
- animation: spin 1s linear infinite;
 
 
 
 
152
  }
153
 
154
- @keyframes spin {
155
- from { transform: rotate(0deg); }
156
- to { transform: rotate(360deg); }
157
  }
158
 
159
- /* Other Styles */
160
- #gallery {
161
- min-height: 22rem;
162
- margin-bottom: 15px;
163
- margin-left: auto;
164
- margin-right: auto;
165
- border-bottom-right-radius: .5rem !important;
166
- border-bottom-left-radius: .5rem !important;
167
- }
168
  """
169
 
170
  with gr.Blocks(css=css) as demo:
@@ -182,12 +159,14 @@ with gr.Blocks(css=css) as demo:
182
  text_button = gr.Button("Generate", variant='primary', elem_id="gen-button")
183
 
184
  with gr.Row():
185
- image_output = gr.Image(type="pil", label="Output Image", elem_id="gallery")
186
 
187
- with gr.Accordion("Advanced settings", open=False):
188
  negative_prompt = gr.Textbox(label="Negative Prompt", value="text, blurry, fuzziness", lines=1, elem_id="negative-prompt-text-input")
189
  image_style = gr.Dropdown(label="Style", choices=["None style", "Cinematic", "Digital Art", "Portrait"], value="None style", allow_custom_value=False)
190
 
191
  text_button.click(generate_txt2img, inputs=[current_model, text_prompt, negative_prompt, image_style], outputs=image_output)
192
 
193
- demo.launch(show_api=False)
 
 
 
81
  /* General Container Styles */
82
  .gradio-container {
83
  font-family: 'IBM Plex Sans', sans-serif;
84
+ max-width: 800px !important;
85
  margin: auto;
86
+ padding-top: 2rem;
87
  }
88
 
89
  /* Button Styles */
90
+ .gr-button-primary {
91
+ color: #fff;
92
+ background-color: #2563eb;
93
+ border-color: #1d4ed8;
 
94
  }
95
 
96
+ .gr-button-primary:hover {
97
+ background-color: #1d4ed8;
98
+ border-color: #1d4ed8;
 
 
 
 
 
 
99
  }
100
 
101
+ /* Input Styles */
102
+ .gr-textbox {
103
+ border-color: #a0aec0;
104
+ padding: 9px 12px;
 
105
  }
106
 
107
+ .gr-textbox:focus {
108
+ border-color: #2563eb;
109
+ box-shadow: 0 0 0 2px rgba(37,99,235,.25);
 
 
 
110
  }
111
 
112
+ /* Output Image Styles */
113
+ #gallery img {
114
+ max-width: 100%;
115
+ height: auto;
116
+ border-radius: 6px;
117
+ box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
 
 
 
118
  }
119
 
120
+ /* Advanced settings accordion styles */
121
+ .gr-accordion-header {
122
+ font-weight: 500;
123
+ color: #4a5568;
124
+ padding: 10px 16px;
125
  }
126
 
127
+ .gr-accordion-panel {
128
+ padding: 0;
 
 
 
 
 
 
 
129
  }
130
 
131
+ /* Footer Styles */
132
+ .footer {
133
+ display: flex;
134
+ justify-content: center;
135
+ align-items: center;
136
+ margin-top: 3rem;
137
+ color: #4a5568;
138
  }
139
 
140
+ .footer p {
141
+ margin-bottom: 0;
142
+ font-size: 0.875rem;
143
  }
144
 
 
 
 
 
 
 
 
 
 
145
  """
146
 
147
  with gr.Blocks(css=css) as demo:
 
159
  text_button = gr.Button("Generate", variant='primary', elem_id="gen-button")
160
 
161
  with gr.Row():
162
+ image_output = gr.Image(type="pil", label="Generated Image", elem_id="gallery")
163
 
164
+ with gr.Accordion("Advanced Settings", open=False):
165
  negative_prompt = gr.Textbox(label="Negative Prompt", value="text, blurry, fuzziness", lines=1, elem_id="negative-prompt-text-input")
166
  image_style = gr.Dropdown(label="Style", choices=["None style", "Cinematic", "Digital Art", "Portrait"], value="None style", allow_custom_value=False)
167
 
168
  text_button.click(generate_txt2img, inputs=[current_model, text_prompt, negative_prompt, image_style], outputs=image_output)
169
 
170
+ gr.Footer("Powered by ngoctuanai", outbound_link="")
171
+
172
+ demo.launch()