ginipick commited on
Commit
0225ff8
·
verified ·
1 Parent(s): b60dc0f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +95 -25
app.py CHANGED
@@ -16,7 +16,7 @@ if not os.path.exists(SAVE_DIR):
16
 
17
  device = "cuda" if torch.cuda.is_available() else "cpu"
18
  repo_id = "black-forest-labs/FLUX.1-dev"
19
- adapter_id = "openfree/claude-monet"
20
 
21
  pipeline = DiffusionPipeline.from_pretrained(repo_id, torch_dtype=torch.bfloat16)
22
  pipeline.load_lora_weights(adapter_id)
@@ -55,12 +55,12 @@ def load_generated_images():
55
 
56
  def load_predefined_images():
57
  predefined_images = [
58
- "assets/cm1.webp",
59
- "assets/cm2.webp",
60
- "assets/cm3.webp",
61
- "assets/cm4.webp",
62
- "assets/cm5.webp",
63
- "assets/cm6.webp",
64
  ]
65
  return predefined_images
66
 
@@ -97,25 +97,93 @@ def inference(
97
  return image, seed, load_generated_images()
98
 
99
  examples = [
100
- "Claude Monet's 1916 painting, Water Lilies, which is currently on display at the Metropolitan Museum of Art. The painting depicts a tranquil pond with water lilies floating on the surface, surrounded by lush green foliage and a variety of colorful flowers. The colors of the flowers range from bright pinks and purples to deep blues and greens, creating a peaceful and calming atmosphere. [trigger]",
101
- "Claude Monet's 1869 masterpiece, The Magpie, showcasing a snow-covered rural landscape at dawn. A single black magpie perches on a wooden gate, contrasting against the pristine white snow. The scene captures the subtle interplay of light and shadow on the snow's surface, with delicate blue-gray tones in the shadows and warm golden hints where sunlight touches the snow-laden branches. [trigger]",
102
- "Claude Monet's Impression, Sunrise (1872), depicting the port of Le Havre at dawn. The orange sun hangs low in a misty gray-blue sky, its reflection dancing across the rippling harbor waters. Small boats appear as dark silhouettes against the luminous morning light, while industrial chimneys in the background release wisps of smoke into the atmospheric scene. [trigger]",
103
- "Claude Monet's Rouen Cathedral series (1892-1894), focusing on the western facade at sunset. The gothic architecture is bathed in warm golden light, with deep purple shadows in the intricate stone carvings. The cathedral's spires reach toward a sky painted in soft pinks and lavenders, showcasing Monet's masterful handling of light and atmospheric effects. [trigger]",
104
- "Claude Monet's Japanese Bridge at Giverny (1899), featuring the iconic green curved bridge spanning his water garden. Clusters of purple and white wisteria cascade from above, their reflections merging with the lily pads below in the tranquil pond. Weeping willows frame the scene in characteristic Monet brushstrokes, creating a dreamy, impressionist atmosphere. [trigger]",
105
- "Claude Monet's Haystacks at Sunset (1890), showing golden wheat stacks in a field at dusk. The massive forms of the haystacks stand silhouetted against a dramatic sky painted in bold strokes of orange, pink, and deep purple. The surrounding field catches the last rays of sunlight, creating a patchwork of warm earth tones and long blue-violet shadows. [trigger]"
106
  ]
107
 
108
- css = """
 
 
 
 
 
 
109
  footer {
110
  visibility: hidden;
111
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
  """
113
 
114
- with gr.Blocks(theme="Yntec/HaleyCH_Theme_Orange", css=css, analytics_enabled=False) as demo:
115
- gr.HTML('<div class="title"> Claude Monet STUDIO </div>')
116
- gr.HTML('<div class="title">😄Image to Video Explore: <a href="https://huggingface.co/spaces/ginigen/theater" target="_blank">https://huggingface.co/spaces/ginigen/theater</a></div>')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
117
 
118
- with gr.Tabs() as tabs:
119
  with gr.Tab("Generation"):
120
  with gr.Column(elem_id="col-container"):
121
  with gr.Row():
@@ -123,10 +191,10 @@ with gr.Blocks(theme="Yntec/HaleyCH_Theme_Orange", css=css, analytics_enabled=Fa
123
  label="Prompt",
124
  show_label=False,
125
  max_lines=1,
126
- placeholder="Enter your prompt",
127
  container=False,
128
  )
129
- run_button = gr.Button("Run", scale=0)
130
 
131
  result = gr.Image(label="Result", show_label=False)
132
 
@@ -186,25 +254,27 @@ with gr.Blocks(theme="Yntec/HaleyCH_Theme_Orange", css=css, analytics_enabled=Fa
186
  )
187
 
188
  with gr.Tab("Gallery"):
189
- gallery_header = gr.Markdown("### Generated Images Gallery")
190
  generated_gallery = gr.Gallery(
191
  label="Generated Images",
192
- columns=6,
193
  show_label=False,
194
  value=load_generated_images(),
195
  elem_id="generated_gallery",
 
196
  height="auto"
197
  )
198
- refresh_btn = gr.Button("🔄 Refresh Gallery")
199
 
200
  # Add sample gallery section at the bottom
201
- gr.Markdown("### Claude Monet Style Examples")
202
  predefined_gallery = gr.Gallery(
203
  label="Sample Images",
204
  columns=3,
205
  rows=2,
206
  show_label=False,
207
- value=load_predefined_images()
 
208
  )
209
 
210
  # Event handlers
 
16
 
17
  device = "cuda" if torch.cuda.is_available() else "cpu"
18
  repo_id = "black-forest-labs/FLUX.1-dev"
19
+ adapter_id = "openfree/pierre-auguste-renoir" # Changed to Renoir model
20
 
21
  pipeline = DiffusionPipeline.from_pretrained(repo_id, torch_dtype=torch.bfloat16)
22
  pipeline.load_lora_weights(adapter_id)
 
55
 
56
  def load_predefined_images():
57
  predefined_images = [
58
+ "assets/renoir1.webp",
59
+ "assets/renoir2.webp",
60
+ "assets/renoir3.webp",
61
+ "assets/renoir4.webp",
62
+ "assets/renoir5.webp",
63
+ "assets/renoir6.webp",
64
  ]
65
  return predefined_images
66
 
 
97
  return image, seed, load_generated_images()
98
 
99
  examples = [
100
+ "Renoir's painting of a lively outdoor dance scene at Moulin de la Galette, with dappled sunlight filtering through trees, illuminating well-dressed Parisians enjoying a summer afternoon. Couples dance while others socialize at tables, capturing the joie de vivre of 1870s Montmartre. [trigger]",
101
+ "Renoir's intimate portrait of a young woman with rosy cheeks and lips, soft blonde hair, and a gentle smile. She wears a vibrant blue dress against a background of lush flowers and greenery, showcasing his mastery of depicting feminine beauty with warm, luminous skin tones. [trigger]",
102
+ "Renoir's painting of two young girls seated at a piano, captured in his distinctive soft focus style. The scene shows one girl playing while the other stands beside her, both wearing delicate white dresses. The interior setting features warm colors and loose brushwork typical of his mature period. [trigger]",
103
+ "Renoir's painting of an elegant boating party, with fashionably dressed men and women relaxing on a restaurant terrace overlooking the Seine. The scene captures the leisurely atmosphere of 1880s French society, with sparkling water reflections and a bright, airy palette of blues, whites, and warm flesh tones. [trigger]",
104
+ "Renoir's painting of a sun-dappled garden scene with children playing. The composition features vibrant flowers in full bloom, lush greenery, and Renoir's characteristic luminous treatment of sunlight filtering through foliage, creating patches of brilliant color across the canvas. [trigger]",
105
+ "Renoir's depiction of bathers by a riverbank, with several female figures arranged in a harmonious composition. The painting showcases his later style with fuller figures rendered in pearlescent flesh tones against a backdrop of shimmering water and verdant landscape, demonstrating his unique approach to the nude figure in nature. [trigger]"
106
  ]
107
 
108
+ # Brighter custom CSS with vibrant colors
109
+ custom_css = """
110
+ :root {
111
+ --color-primary: #FF9E6C;
112
+ --color-secondary: #FFD8A9;
113
+ }
114
+
115
  footer {
116
  visibility: hidden;
117
  }
118
+
119
+ .gradio-container {
120
+ background: linear-gradient(to right, #FFF4E0, #FFEDDB);
121
+ }
122
+
123
+ .title {
124
+ color: #E25822 !important;
125
+ font-size: 2.5rem !important;
126
+ font-weight: 700 !important;
127
+ text-align: center;
128
+ margin: 1rem 0;
129
+ text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
130
+ }
131
+
132
+ .subtitle {
133
+ color: #2B3A67 !important;
134
+ font-size: 1.2rem !important;
135
+ text-align: center;
136
+ margin-bottom: 2rem;
137
+ }
138
+
139
+ .model-description {
140
+ background-color: rgba(255, 255, 255, 0.7);
141
+ border-radius: 10px;
142
+ padding: 20px;
143
+ margin: 20px 0;
144
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
145
+ border-left: 5px solid #E25822;
146
+ }
147
+
148
+ button.primary {
149
+ background-color: #E25822 !important;
150
+ }
151
+
152
+ button:hover {
153
+ transform: translateY(-2px);
154
+ box-shadow: 0 5px 15px rgba(0,0,0,0.1);
155
+ }
156
+
157
+ .tabs {
158
+ margin-top: 20px;
159
+ }
160
+
161
+ .gallery {
162
+ background-color: rgba(255, 255, 255, 0.5);
163
+ border-radius: 10px;
164
+ padding: 10px;
165
+ }
166
  """
167
 
168
+ with gr.Blocks(theme=gr.themes.Default(), css=custom_css, analytics_enabled=False) as demo:
169
+ gr.HTML('<div class="title">Pierre-Auguste Renoir STUDIO</div>')
170
+ gr.HTML('<div class="subtitle">🎨 Image to Video Explore: <a href="https://huggingface.co/spaces/ginigen/theater" target="_blank">https://huggingface.co/spaces/ginigen/theater</a></div>')
171
+
172
+ # Model description with the requested content
173
+ with gr.Box(elem_classes="model-description"):
174
+ gr.Markdown("""
175
+ # About This Model
176
+
177
+ This studio features the **Pierre-Auguste Renoir** artistic style model from [openfree/pierre-auguste-renoir](https://huggingface.co/openfree/pierre-auguste-renoir).
178
+
179
+ Pierre-Auguste Renoir (1841-1919) was a leading painter in the development of the Impressionist style. His paintings are notable for their vibrant light and saturated color, focusing on people in intimate and candid compositions. The warmth of his palette often emphasized the sensual beauty of his subjects, particularly women.
180
+
181
+ I developed a flux-based learning model trained on a curated collection of high-resolution masterpieces from renowned global artists. This LoRA fine-tuning process leveraged the exceptional quality of open-access imagery released by prestigious institutions including the Art Institute of Chicago. The resulting model demonstrates remarkable capability in capturing the nuanced artistic techniques and stylistic elements across diverse historical art movements.
182
+
183
+ **How to use**: Simply enter a prompt describing a scene in Renoir's style and add [trigger] at the end.
184
+ """)
185
 
186
+ with gr.Tabs(elem_classes="tabs") as tabs:
187
  with gr.Tab("Generation"):
188
  with gr.Column(elem_id="col-container"):
189
  with gr.Row():
 
191
  label="Prompt",
192
  show_label=False,
193
  max_lines=1,
194
+ placeholder="Enter your prompt (add [trigger] at the end)",
195
  container=False,
196
  )
197
+ run_button = gr.Button("Generate", variant="primary", scale=0)
198
 
199
  result = gr.Image(label="Result", show_label=False)
200
 
 
254
  )
255
 
256
  with gr.Tab("Gallery"):
257
+ gallery_header = gr.Markdown("### Your Generated Images")
258
  generated_gallery = gr.Gallery(
259
  label="Generated Images",
260
+ columns=3,
261
  show_label=False,
262
  value=load_generated_images(),
263
  elem_id="generated_gallery",
264
+ elem_classes="gallery",
265
  height="auto"
266
  )
267
+ refresh_btn = gr.Button("🔄 Refresh Gallery", variant="primary")
268
 
269
  # Add sample gallery section at the bottom
270
+ gr.Markdown("### Pierre-Auguste Renoir Style Examples")
271
  predefined_gallery = gr.Gallery(
272
  label="Sample Images",
273
  columns=3,
274
  rows=2,
275
  show_label=False,
276
+ value=load_predefined_images(),
277
+ elem_classes="gallery"
278
  )
279
 
280
  # Event handlers