RohitGandikota commited on
Commit
d584012
·
verified ·
1 Parent(s): 68b0dc5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -64
app.py CHANGED
@@ -248,58 +248,6 @@ simple_instructions = """ User Guide: We released sliderspace directions for a f
248
  - Finally, write a prompt for the concept you chose. (eg. "picture of a wizard fighting a magical war")
249
  - Click Generate and discover what the direction is !! """
250
 
251
- # Detailed instructions
252
- detailed_instructions = """# SliderSpace User Guide
253
-
254
- ## Overview
255
- SliderSpace allows you to explore diffusion model knowledge's concept directions. This tool helps you discover how different "directions" in the latent space can influence image generation for specific concepts.
256
-
257
- ## Detailed Navigation Instructions
258
-
259
- ### Step 1: Select Your Concept
260
- - Locate the dropdown menu labeled `SliderSpace trained on`
261
- - Click to expand the menu and view all available concept categories
262
- - Select the concept you want to explore (e.g., "Wizard", "Animal", "Landscape")
263
- - Each concept has been pre-trained with multiple discoverable directions
264
-
265
- ### Step 2: Choose a Direction to Explore
266
- - Find the `Discovered Directions` dropdown menu
267
- - Click to view all available directions for your selected concept
268
- - Select one of the numbered directions (e.g., "Direction 3")
269
- - Each direction represents a different aspect or variation of the concept
270
- - Try multiple directions to see how they affect your results
271
-
272
- ### Step 3: Adjust the Slider Weight
273
- - Locate the slider control for weight adjustment
274
- - Move the slider to set a value between -1 and 1 (this is the recommended range)
275
- - Negative values (-1 to 0) will move away from the direction
276
- - Positive values (0 to 1) will enhance the direction
277
- - For experimental results, you can try more extreme values (e.g., +1.5 or -1.5)
278
- - The weight determines how strongly the direction influences your generated image
279
-
280
- ### Step 4: Write Your Prompt
281
- - Enter a text prompt in the provided text field
282
- - Make sure your prompt relates to the concept you selected in Step 1
283
- - Be specific about what you want to see (e.g., "picture of a wizard fighting a magical war")
284
- - The prompt works together with the direction and weight to generate the final image
285
-
286
- ### Step 5: Generate and Analyze
287
- - Click the `Generate` button to create your image
288
- - Observe how the selected direction affects the output
289
- - Compare results with different directions and weights to understand each direction's effect
290
- - Use these observations to discover what each direction represents in the latent space
291
-
292
- ## Tips for Best Results
293
- - Keep notes on which directions create specific effects
294
- - Try the same prompt with different directions to see varied results
295
- - Experiment with subtle weight changes for fine-tuning
296
- - Some directions work better with specific types of prompts
297
-
298
- ## Troubleshooting
299
- - If results aren't as expected, try adjusting the weight to a more moderate value
300
- - Ensure your prompt clearly relates to the selected concept
301
- - Try multiple directions if you're not seeing the effect you want
302
- """
303
  # Define a function to toggle instructions that correctly handles both states
304
  def toggle_instructions(is_detailed):
305
  # Toggle the state
@@ -319,18 +267,6 @@ with gr.Blocks(css=css) as demo:
319
  💻 [GitHub Code](https://github.com/rohitgandikota/sliderspace)
320
  """)
321
 
322
- with gr.Row():
323
- with gr.Column():
324
- instructions_md = gr.Markdown(simple_instructions)
325
- # toggle_btn = gr.Button("Show Detailed Instructions")
326
-
327
- # # Toggle button to switch between simple and detailed instructions
328
- # toggle_btn.click(
329
- # fn=toggle_instructions,
330
- # inputs=[gr.State(False)], # Initial state is False (simple instructions)
331
- # outputs=[instructions_md, toggle_btn, gr.State()] # Return updated state
332
- # )
333
-
334
  with gr.Row():
335
  prompt = gr.Text(
336
  label="Prompt",
@@ -425,6 +361,8 @@ with gr.Blocks(css=css) as demo:
425
  step=1,
426
  value=4, # Replace with defaults that work for your model
427
  )
 
 
428
  # Add event handler for model selection
429
  model_choice.change(
430
  fn=update_sliderspace_choices,
 
248
  - Finally, write a prompt for the concept you chose. (eg. "picture of a wizard fighting a magical war")
249
  - Click Generate and discover what the direction is !! """
250
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
251
  # Define a function to toggle instructions that correctly handles both states
252
  def toggle_instructions(is_detailed):
253
  # Toggle the state
 
267
  💻 [GitHub Code](https://github.com/rohitgandikota/sliderspace)
268
  """)
269
 
 
 
 
 
 
 
 
 
 
 
 
 
270
  with gr.Row():
271
  prompt = gr.Text(
272
  label="Prompt",
 
361
  step=1,
362
  value=4, # Replace with defaults that work for your model
363
  )
364
+ with gr.Row():
365
+ gr.Markdown(simple_instructions)
366
  # Add event handler for model selection
367
  model_choice.change(
368
  fn=update_sliderspace_choices,