shibing624 commited on
Commit
fdd48fd
1 Parent(s): c517a0d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -0
app.py CHANGED
@@ -99,6 +99,9 @@ def preprocess_image(image_input) -> Image.Image:
99
 
100
 
101
  def main():
 
 
 
102
  # we get about 25k images from Unsplash
103
  img_folder = 'photos/'
104
  clip_folder = 'photos/csv/'
@@ -186,11 +189,19 @@ def main():
186
  with gr.Row():
187
  with gr.Column():
188
  input_text = gr.Textbox(lines=2, placeholder="Enter text here...")
 
 
 
 
189
 
190
  with gr.Tab("Image"):
191
  with gr.Row():
192
  with gr.Column():
193
  input_image = gr.Image(type="filepath", label="Upload an image")
 
 
 
 
194
 
195
  btn_submit = gr.Button(label="Submit")
196
  output = gr.outputs.HTML(label="Search results")
@@ -203,3 +214,4 @@ def main():
203
 
204
  if __name__ == '__main__':
205
  main()
 
 
99
 
100
 
101
  def main():
102
+ text_examples = [["黑猫"], ["坐着的女孩"], ["两只狗拉雪橇"], ["tiger"], ["full Moon"]]
103
+ image_examples = [["photos/YMJ1IiItvPY.jpg"], ["photos/6Fo47c49zEQ.jpg"], ["photos/OM7CvKnhjfs.jpg"],
104
+ ["photos/lyStEjlKNSw.jpg"], ["photos/mCbo65vkb80.jpg"]]
105
  # we get about 25k images from Unsplash
106
  img_folder = 'photos/'
107
  clip_folder = 'photos/csv/'
 
189
  with gr.Row():
190
  with gr.Column():
191
  input_text = gr.Textbox(lines=2, placeholder="Enter text here...")
192
+ gr.Examples(
193
+ examples=text_examples,
194
+ inputs=[input_text],
195
+ )
196
 
197
  with gr.Tab("Image"):
198
  with gr.Row():
199
  with gr.Column():
200
  input_image = gr.Image(type="filepath", label="Upload an image")
201
+ gr.Examples(
202
+ examples=image_examples,
203
+ inputs=[input_image],
204
+ )
205
 
206
  btn_submit = gr.Button(label="Submit")
207
  output = gr.outputs.HTML(label="Search results")
 
214
 
215
  if __name__ == '__main__':
216
  main()
217
+