seawolf2357 commited on
Commit
d336934
·
verified ·
1 Parent(s): 276571f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +67 -1
app.py CHANGED
@@ -40,6 +40,9 @@ compel = Compel(
40
  MAX_SEED = np.iinfo(np.int32).max
41
  MAX_IMAGE_SIZE = 1216
42
 
 
 
 
43
  # 追加: Simple long prompt processing function
44
  def process_long_prompt(prompt, negative_prompt=""):
45
  """Simple long prompt processing using Compel"""
@@ -100,23 +103,86 @@ def infer(prompt, negative_prompt, seed, randomize_seed, width, height, guidance
100
 
101
 
102
  css = """
 
103
  #col-container {
104
  margin: 0 auto;
105
  max-width: 520px;
106
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
  """
108
 
109
  with gr.Blocks(css=css) as demo:
110
 
111
  with gr.Column(elem_id="col-container"):
 
 
 
 
 
 
112
 
113
  with gr.Row():
114
  prompt = gr.Text(
115
  label="Prompt",
116
  show_label=False,
117
  max_lines=1,
118
- placeholder="Enter your prompt (long prompts are automatically supported)", # 変更: Updated placeholder
119
  container=False,
 
120
  )
121
 
122
  run_button = gr.Button("Run", scale=0)
 
40
  MAX_SEED = np.iinfo(np.int32).max
41
  MAX_IMAGE_SIZE = 1216
42
 
43
+ # Default prompt
44
+ DEFAULT_PROMPT = "Detailed illustration, realistic style, portrait of a beautiful Japanese woman, wearing an elegant traditional Japanese uniform, neatly tailored with intricate patterns and subtle textures, serene expression, soft natural lighting, standing gracefully in a traditional Japanese garden with cherry blossom petals gently falling in the background, cinematic quality, ultra-detailed, high-resolution, warm tones"
45
+
46
  # 追加: Simple long prompt processing function
47
  def process_long_prompt(prompt, negative_prompt=""):
48
  """Simple long prompt processing using Compel"""
 
103
 
104
 
105
  css = """
106
+ /* Main container styling */
107
  #col-container {
108
  margin: 0 auto;
109
  max-width: 520px;
110
  }
111
+
112
+ /* Gradient background for the entire app */
113
+ .gradio-container {
114
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 25%, #f093fb 50%, #f5576c 75%, #ffc947 100%);
115
+ min-height: 100vh;
116
+ }
117
+
118
+ /* Main block styling with semi-transparent background */
119
+ .contain {
120
+ background: rgba(255, 255, 255, 0.95);
121
+ border-radius: 20px;
122
+ padding: 20px;
123
+ box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
124
+ backdrop-filter: blur(4px);
125
+ border: 1px solid rgba(255, 255, 255, 0.18);
126
+ }
127
+
128
+ /* Input field styling */
129
+ .gr-text-input {
130
+ background: rgba(255, 255, 255, 0.9) !important;
131
+ border: 2px solid rgba(102, 126, 234, 0.3) !important;
132
+ border-radius: 10px !important;
133
+ }
134
+
135
+ /* Button styling */
136
+ .gr-button {
137
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
138
+ border: none !important;
139
+ color: white !important;
140
+ font-weight: bold !important;
141
+ transition: all 0.3s ease !important;
142
+ }
143
+
144
+ .gr-button:hover {
145
+ transform: translateY(-2px);
146
+ box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
147
+ }
148
+
149
+ /* Accordion styling */
150
+ .gr-accordion {
151
+ background: rgba(255, 255, 255, 0.8) !important;
152
+ border-radius: 10px !important;
153
+ margin-top: 10px !important;
154
+ }
155
+
156
+ /* Result image container */
157
+ .gr-image {
158
+ border-radius: 15px !important;
159
+ box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1) !important;
160
+ }
161
+
162
+ /* Slider styling */
163
+ .gr-slider {
164
+ background: rgba(255, 255, 255, 0.8) !important;
165
+ }
166
  """
167
 
168
  with gr.Blocks(css=css) as demo:
169
 
170
  with gr.Column(elem_id="col-container"):
171
+ gr.Markdown(
172
+ """
173
+ # 🎨 Stable Diffusion XL Image Generator
174
+ ### Create beautiful images with AI
175
+ """
176
+ )
177
 
178
  with gr.Row():
179
  prompt = gr.Text(
180
  label="Prompt",
181
  show_label=False,
182
  max_lines=1,
183
+ placeholder="Enter your prompt (long prompts are automatically supported)",
184
  container=False,
185
+ value=DEFAULT_PROMPT # Set default prompt
186
  )
187
 
188
  run_button = gr.Button("Run", scale=0)