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

More examples

Browse files
Files changed (4) hide show
  1. .gitattributes +2 -0
  2. app.py +10 -6
  3. rainbow.jpeg +3 -0
  4. selfie.png +3 -0
.gitattributes CHANGED
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ *.png filter=lfs diff=lfs merge=lfs -text
37
+ *.jpeg filter=lfs diff=lfs merge=lfs -text
app.py CHANGED
@@ -6,10 +6,14 @@ from haystack.nodes import PromptNode, PromptTemplate
6
  from haystack import Pipeline
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
  """
@@ -27,7 +31,7 @@ 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()
@@ -37,13 +41,13 @@ def generate_caption(image_file_paths, model_name):
37
  caption = captioning_pipeline.run(file_paths=[image_file_paths])
38
  return caption["results"][0]
39
 
40
- with gr.Blocks(theme="monochrome") as demo:
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])
 
6
  from haystack import Pipeline
7
 
8
  description = """
9
+ # Captionate 📸
10
+ ### Create Instagram captions for your pics!
11
 
12
+ * Upload your photo or select one from examples
13
+ * Choose your model
14
+ * ✨ Captionate! ✨
15
+
16
+ `OpenAssistant/oasst-sft-4-pythia-12b-epoch-3.5` and `tiiuae/falcon-7b-instruct` perform the best but try out different models to see how they react to the same prompt.
17
 
18
  Built by [Bilge Yucel](https://twitter.com/bilgeycl) using [Haystack](https://github.com/deepset-ai/haystack) 💙
19
  """
 
31
  Instagram Caption:
32
  """)
33
 
34
+ hf_api_key = os.environ["HF_API_KEY"]
35
 
36
  def generate_caption(image_file_paths, model_name):
37
  captioning_pipeline = Pipeline()
 
41
  caption = captioning_pipeline.run(file_paths=[image_file_paths])
42
  return caption["results"][0]
43
 
44
+ with gr.Blocks(theme="soft") as demo:
45
  gr.Markdown(value=description)
46
  with gr.Row():
47
  image = gr.Image(type="filepath")
48
  with gr.Column():
49
  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!")
50
+ gr.Examples(["./whale.png", "./rainbow.jpeg", "./selfie.png"], inputs=image, label="Click on any example")
51
  submit_btn = gr.Button("✨ Captionate ✨")
52
  caption = gr.Textbox(label="Caption", show_copy_button=True)
53
  submit_btn.click(fn=generate_caption, inputs=[image, model_name], outputs=[caption])
rainbow.jpeg ADDED

Git LFS Details

  • SHA256: 793a51aedc20557ceaceca17eb194b1ffa711c7e046e44b4257e9e483e5d96f9
  • Pointer size: 131 Bytes
  • Size of remote file: 360 kB
selfie.png ADDED

Git LFS Details

  • SHA256: 8cc02e8f19d22b6b579521399f8dc8790c94df9c5422e14a0bb7033c9deb6bed
  • Pointer size: 132 Bytes
  • Size of remote file: 9.45 MB