fantaxy commited on
Commit
91b37f6
ยท
verified ยท
1 Parent(s): 0dc0c33

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -2
app.py CHANGED
@@ -67,6 +67,9 @@ examples = [
67
  ["A fantasy map of a fictional world, with detailed terrain and cities.", "q19.webp"]
68
  ]
69
 
 
 
 
70
  with gr.Blocks(theme="Nymbo/Nymbo_Theme", css=css) as demo:
71
  gr.Markdown("# Image Generation with Examples")
72
 
@@ -79,9 +82,15 @@ with gr.Blocks(theme="Nymbo/Nymbo_Theme", css=css) as demo:
79
  with gr.Column():
80
  gr.Image(image_file, label=prompt[:50] + "...") # ํ”„๋กฌํ”„ํŠธ์˜ ์ฒ˜์Œ 50์ž๋งŒ ํ‘œ์‹œ
81
  gr.Button("Use this prompt").click(
82
- fn=lambda p=prompt: input_text.update(value=p),
 
 
 
 
 
 
83
  inputs=[],
84
- outputs=[input_text]
85
  )
86
 
87
  input_text.submit(fn=respond, inputs=input_text, outputs=output_image)
 
67
  ["A fantasy map of a fictional world, with detailed terrain and cities.", "q19.webp"]
68
  ]
69
 
70
+ def use_prompt(prompt):
71
+ return prompt
72
+
73
  with gr.Blocks(theme="Nymbo/Nymbo_Theme", css=css) as demo:
74
  gr.Markdown("# Image Generation with Examples")
75
 
 
82
  with gr.Column():
83
  gr.Image(image_file, label=prompt[:50] + "...") # ํ”„๋กฌํ”„ํŠธ์˜ ์ฒ˜์Œ 50์ž๋งŒ ํ‘œ์‹œ
84
  gr.Button("Use this prompt").click(
85
+ fn=use_prompt,
86
+ inputs=[],
87
+ outputs=input_text,
88
+ _js="(x) => x",
89
+ api_name=False
90
+ ).then(
91
+ fn=lambda: prompt,
92
  inputs=[],
93
+ outputs=input_text
94
  )
95
 
96
  input_text.submit(fn=respond, inputs=input_text, outputs=output_image)