bilgeyucel commited on
Commit
418a286
1 Parent(s): 691d15a

Add example

Browse files
Files changed (2) hide show
  1. app.py +7 -5
  2. whale.png +0 -0
app.py CHANGED
@@ -7,9 +7,9 @@ from haystack import Pipeline
7
 
8
  description = """
9
  # Captionate ✨ 📸
10
- ## Create Instagram captions for your pics!
11
-
12
 
 
13
 
14
  Built by [Bilge Yucel](https://twitter.com/bilgeycl) using [Haystack](https://github.com/deepset-ai/haystack) 💙
15
  """
@@ -24,10 +24,10 @@ You will receive a descriptive text of a photo.
24
  Try to come up with a nice Instagram caption that has a phrase rhyming with the text. Include emojis to the caption.
25
 
26
  Descriptive text: {documents};
27
- Caption:
28
  """)
29
 
30
- hf_api_key = os.environ["HF_API_KEY"]
31
 
32
  def generate_caption(image_file_paths, model_name):
33
  captioning_pipeline = Pipeline()
@@ -41,7 +41,9 @@ with gr.Blocks(theme="monochrome") as demo:
41
  gr.Markdown(value=description)
42
  with gr.Row():
43
  image = gr.Image(type="filepath")
44
- model_name = gr.Dropdown(["tiiuae/falcon-7b-instruct", "tiiuae/falcon-7b", "EleutherAI/gpt-neox-20b", "HuggingFaceH4/starchat-beta", "OpenAssistant/oasst-sft-4-pythia-12b-epoch-3.5", "bigscience/bloom"], value="tiiuae/falcon-7b-instruct", label="Choose your model!")
 
 
45
  submit_btn = gr.Button("✨ Captionate ✨")
46
  caption = gr.Textbox(label="Caption", show_copy_button=True)
47
  submit_btn.click(fn=generate_caption, inputs=[image, model_name], outputs=[caption])
 
7
 
8
  description = """
9
  # Captionate ✨ 📸
10
+ ### Create Instagram captions for your pics!
 
11
 
12
+ `OpenAssistant/oasst-sft-4-pythia-12b-epoch-3.5` and `tiiuae/falcon-7b-instruct` perform the best but try out different model to see how they react to the same prompt.
13
 
14
  Built by [Bilge Yucel](https://twitter.com/bilgeycl) using [Haystack](https://github.com/deepset-ai/haystack) 💙
15
  """
 
24
  Try to come up with a nice Instagram caption that has a phrase rhyming with the text. Include emojis to the caption.
25
 
26
  Descriptive text: {documents};
27
+ Instagram Caption:
28
  """)
29
 
30
+ hf_api_key = "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"
31
 
32
  def generate_caption(image_file_paths, model_name):
33
  captioning_pipeline = Pipeline()
 
41
  gr.Markdown(value=description)
42
  with gr.Row():
43
  image = gr.Image(type="filepath")
44
+ with gr.Column():
45
+ model_name = gr.Dropdown(["OpenAssistant/oasst-sft-4-pythia-12b-epoch-3.5", "tiiuae/falcon-7b-instruct", "tiiuae/falcon-7b", "EleutherAI/gpt-neox-20b", "HuggingFaceH4/starchat-beta", "bigscience/bloom"], value="OpenAssistant/oasst-sft-4-pythia-12b-epoch-3.5", label="Choose your model!")
46
+ gr.Examples(["./whale.png"], examples_per_page=1, inputs=image, label="Click on any example")
47
  submit_btn = gr.Button("✨ Captionate ✨")
48
  caption = gr.Textbox(label="Caption", show_copy_button=True)
49
  submit_btn.click(fn=generate_caption, inputs=[image, model_name], outputs=[caption])
whale.png ADDED