Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -29,11 +29,11 @@ def infer(image_input):
|
|
29 |
4, # int | float (numeric value between 2 and 24) in 'best mode max flavors' Slider component
|
30 |
api_name="/clipi2"
|
31 |
)
|
32 |
-
print(clipi_result)
|
33 |
|
34 |
|
35 |
llama_q = f"""
|
36 |
-
I'll give you a simple image caption, from i want you to provide a story that would fit well with the image. Please be creative and only generate a fictional story.
|
37 |
Here's the image description:
|
38 |
'{clipi_result[0]}'
|
39 |
|
@@ -126,7 +126,8 @@ with gr.Blocks(css=css) as demo:
|
|
126 |
)
|
127 |
with gr.Row():
|
128 |
with gr.Column():
|
129 |
-
image_in = gr.Image(label="Image input", type="filepath", elem_id="image-in", height=
|
|
|
130 |
submit_btn = gr.Button('Tell me a story')
|
131 |
with gr.Column():
|
132 |
#caption = gr.Textbox(label="Generated Caption")
|
@@ -137,14 +138,14 @@ with gr.Blocks(css=css) as demo:
|
|
137 |
loading_icon = gr.HTML(loading_icon_html)
|
138 |
share_button = gr.Button("Share to community", elem_id="share-btn")
|
139 |
|
140 |
-
gr.Examples(examples=[["./examples/crabby.png"],["./examples/hopper.jpeg"]],
|
141 |
fn=infer,
|
142 |
-
inputs=[image_in],
|
143 |
outputs=[story, share_group],
|
144 |
cache_examples=True
|
145 |
)
|
146 |
|
147 |
-
submit_btn.click(fn=infer, inputs=[image_in], outputs=[story, share_group])
|
148 |
share_button.click(None, [], [], _js=share_js)
|
149 |
|
150 |
demo.queue(max_size=12).launch()
|
|
|
29 |
4, # int | float (numeric value between 2 and 24) in 'best mode max flavors' Slider component
|
30 |
api_name="/clipi2"
|
31 |
)
|
32 |
+
print(clipi_result, audience)
|
33 |
|
34 |
|
35 |
llama_q = f"""
|
36 |
+
I'll give you a simple image caption, from i want you to provide a story for a {audience} audience that would fit well with the image. Please be creative and only generate a fictional story.
|
37 |
Here's the image description:
|
38 |
'{clipi_result[0]}'
|
39 |
|
|
|
126 |
)
|
127 |
with gr.Row():
|
128 |
with gr.Column():
|
129 |
+
image_in = gr.Image(label="Image input", type="filepath", elem_id="image-in", height=420)
|
130 |
+
audience = gr.Radio(label="Target Audience", choices=["Children", "Adult"], value="Children")
|
131 |
submit_btn = gr.Button('Tell me a story')
|
132 |
with gr.Column():
|
133 |
#caption = gr.Textbox(label="Generated Caption")
|
|
|
138 |
loading_icon = gr.HTML(loading_icon_html)
|
139 |
share_button = gr.Button("Share to community", elem_id="share-btn")
|
140 |
|
141 |
+
gr.Examples(examples=[["./examples/crabby.png", "Children"],["./examples/hopper.jpeg", "Adult"]],
|
142 |
fn=infer,
|
143 |
+
inputs=[image_in, audience],
|
144 |
outputs=[story, share_group],
|
145 |
cache_examples=True
|
146 |
)
|
147 |
|
148 |
+
submit_btn.click(fn=infer, inputs=[image_in, audience], outputs=[story, share_group])
|
149 |
share_button.click(None, [], [], _js=share_js)
|
150 |
|
151 |
demo.queue(max_size=12).launch()
|