hellokitty commited on
Commit
65529ba
·
1 Parent(s): 35e25fe

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -35,7 +35,9 @@ img#style-image {
35
  max-height: 600px;
36
  }
37
  '''
38
- examples = [f"example{i}.jpg" for i in range(1,7)]
 
 
39
  demo = gr.Blocks(css=css)
40
  with demo:
41
  gr.Markdown('''<h1 id="title">Image Captioning 🖼️</h1>''')
@@ -44,6 +46,6 @@ with demo:
44
  output = gr.outputs.Textbox(type="auto",label="Captions")
45
  examples = examples
46
  btn = gr.Button("Generate Caption")
47
- btn.click(fn=predict, inputs=input, outputs=output)
48
 
49
  demo.launch()
 
35
  max-height: 600px;
36
  }
37
  '''
38
+ def set_example_image(example: list) -> dict:
39
+ return gr.Image.update(value=example[0])
40
+
41
  demo = gr.Blocks(css=css)
42
  with demo:
43
  gr.Markdown('''<h1 id="title">Image Captioning 🖼️</h1>''')
 
46
  output = gr.outputs.Textbox(type="auto",label="Captions")
47
  examples = examples
48
  btn = gr.Button("Generate Caption")
49
+ btn.click(fn=predict, inputs=input, outputs=output, examples = examples)
50
 
51
  demo.launch()