akhaliq HF Staff commited on
Commit
f81c51a
·
verified ·
1 Parent(s): a5aefb3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -11
app.py CHANGED
@@ -88,13 +88,11 @@ def edit_image(
88
  except Exception as e:
89
  raise gr.Error(f"Error during image editing: {str(e)}")
90
 
91
- # Example prompts
92
- example_prompts = [
93
- ["将猫变成狗", "", 4.5, 50, 42],
94
- ["Change the cat to a dog", "", 4.5, 50, 42],
95
- ["将背景变成海滩", "", 4.5, 50, 43],
96
- ["Make it nighttime", "", 4.5, 50, 44],
97
- ["将图片转换为油画风格", "", 4.5, 50, 45],
98
  ]
99
 
100
  # Build Gradio interface
@@ -197,11 +195,14 @@ with gr.Blocks(fill_height=True) as demo:
197
  """)
198
 
199
  # Examples section
200
- gr.Markdown("### 📝 Example Prompts")
201
  gr.Examples(
202
- examples=example_prompts,
203
- inputs=[prompt, negative_prompt, guidance_scale, num_inference_steps, seed],
204
- label="Click to try these examples"
 
 
 
205
  )
206
 
207
  # Event handlers
 
88
  except Exception as e:
89
  raise gr.Error(f"Error during image editing: {str(e)}")
90
 
91
+ # Example with image
92
+ example_image_url = "https://huggingface.co/datasets/huggingface/brand-assets/resolve/main/hf-logo.png"
93
+
94
+ example_data = [
95
+ [example_image_url, "Make the background gradient from blue to purple", "", 4.5, 50, 42],
 
 
96
  ]
97
 
98
  # Build Gradio interface
 
195
  """)
196
 
197
  # Examples section
198
+ gr.Markdown("### 📝 Example")
199
  gr.Examples(
200
+ examples=example_data,
201
+ inputs=[input_image, prompt, negative_prompt, guidance_scale, num_inference_steps, seed],
202
+ outputs=output_image,
203
+ fn=edit_image,
204
+ cache_examples=False,
205
+ label="Click to try this example"
206
  )
207
 
208
  # Event handlers