DemahAlmutairi commited on
Commit
04cb248
·
verified ·
1 Parent(s): 35a5b16

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -6
app.py CHANGED
@@ -38,9 +38,8 @@ def parse_input(image, sketchpad, state):
38
  def tabs_select(e: gr.SelectData, _state):
39
  _state["tab_index"] = e.index
40
 
41
- example_img_path = "https://sl.bing.net/i3YznO6vkiW"
42
- def use_example_img():
43
- return example_img_path
44
 
45
  with gr.Blocks() as iface:
46
  gr.HTML("""<p align="center"><img src="https://cdn-icons-png.flaticon.com/512/5853/5853758.png" style="height: 60px"/><p>""")
@@ -59,8 +58,15 @@ with gr.Blocks() as iface:
59
  input_tabs.select(fn=tabs_select, inputs=[state])
60
 
61
 
62
- example_img = gr.Image(value = example_img_path, label="Example image", interactive =True)
63
-
 
 
 
 
 
 
 
64
 
65
  with gr.Row():
66
  with gr.Column():
@@ -72,7 +78,7 @@ with gr.Blocks() as iface:
72
  fn=parse_input,
73
  inputs=[input_image, input_sketchpad, state],
74
  outputs= gr.Textbox(label = "Result"))
75
- example_img.click(use_example_img, outputs = input_image)
76
  # Launch the interface
77
  if __name__ == "__main__":
78
  iface.launch()
 
38
  def tabs_select(e: gr.SelectData, _state):
39
  _state["tab_index"] = e.index
40
 
41
+ example_img_path = "https://4.img-dpreview.com/files/p/E~TS590x0~articles/3925134721/0266554465.jpeg"
42
+
 
43
 
44
  with gr.Blocks() as iface:
45
  gr.HTML("""<p align="center"><img src="https://cdn-icons-png.flaticon.com/512/5853/5853758.png" style="height: 60px"/><p>""")
 
58
  input_tabs.select(fn=tabs_select, inputs=[state])
59
 
60
 
61
+
62
+ with gr.Row(elem_id="examples_row"):
63
+ with gr.Column(elem_id="examples_container"):
64
+ gr.Markdown("### Example Prompts")
65
+ gr.Examples(
66
+ [example_img_path],
67
+ inputs=[input_image],
68
+ cache_examples=False
69
+ )
70
 
71
  with gr.Row():
72
  with gr.Column():
 
78
  fn=parse_input,
79
  inputs=[input_image, input_sketchpad, state],
80
  outputs= gr.Textbox(label = "Result"))
81
+
82
  # Launch the interface
83
  if __name__ == "__main__":
84
  iface.launch()