create readme
Browse files- src/app_cached_videos.py +9 -4
src/app_cached_videos.py
CHANGED
@@ -44,7 +44,7 @@ def overlay_mask(img, mask):
|
|
44 |
alpha_channel[mask_resized < 5] = 0
|
45 |
|
46 |
# Set the opacity level for non-black pixels
|
47 |
-
opacity = 0.
|
48 |
alpha_channel[mask_resized != 0] = int(255 * opacity)
|
49 |
|
50 |
# Create a 4-channel image (BGR + Alpha)
|
@@ -106,9 +106,6 @@ data_path = Path(
|
|
106 |
available_prompts = ['a dog and a cat sitting','A fish swimming in the water', 'A spider descending from its web', 'An astronaut riding a horse']
|
107 |
|
108 |
with gr.Blocks(css=css) as demo:
|
109 |
-
# gr.Markdown("""
|
110 |
-
# # Peekaboo Demo
|
111 |
-
# """)
|
112 |
with gr.Row():
|
113 |
video_1 = gr.Image(label="Image", )
|
114 |
# video_1 = gr.Image(label="Image", width=256, height=256)
|
@@ -120,6 +117,14 @@ with gr.Blocks(css=css) as demo:
|
|
120 |
return gr.Radio(text.strip().split(' '), value=None, label='Choose a word to visualize its attention mask.')
|
121 |
|
122 |
text = 'a dog and a cat sitting'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
with gr.Group("Video Selection"):
|
124 |
txt_1 = gr.Dropdown(choices=available_prompts, label="Video Prompt", value=available_prompts[0])
|
125 |
submit_btn = gr.Button('Get words')
|
|
|
44 |
alpha_channel[mask_resized < 5] = 0
|
45 |
|
46 |
# Set the opacity level for non-black pixels
|
47 |
+
opacity = 0.35 # Adjust this value as needed (0.0 to 1.0)
|
48 |
alpha_channel[mask_resized != 0] = int(255 * opacity)
|
49 |
|
50 |
# Create a 4-channel image (BGR + Alpha)
|
|
|
106 |
available_prompts = ['a dog and a cat sitting','A fish swimming in the water', 'A spider descending from its web', 'An astronaut riding a horse']
|
107 |
|
108 |
with gr.Blocks(css=css) as demo:
|
|
|
|
|
|
|
109 |
with gr.Row():
|
110 |
video_1 = gr.Image(label="Image", )
|
111 |
# video_1 = gr.Image(label="Image", width=256, height=256)
|
|
|
117 |
return gr.Radio(text.strip().split(' '), value=None, label='Choose a word to visualize its attention mask.')
|
118 |
|
119 |
text = 'a dog and a cat sitting'
|
120 |
+
gr.Markdown("""
|
121 |
+
## Visualizing Attention Masks
|
122 |
+
* Select a prompt from the drop down
|
123 |
+
* Click on "Get words" to get the words in the prompt
|
124 |
+
* Select a radio button from the words to visualize the attention mask
|
125 |
+
* Play around with the index of diffusion steps, layers to visualize different masks
|
126 |
+
""")
|
127 |
+
|
128 |
with gr.Group("Video Selection"):
|
129 |
txt_1 = gr.Dropdown(choices=available_prompts, label="Video Prompt", value=available_prompts[0])
|
130 |
submit_btn = gr.Button('Get words')
|