Update app.py
Browse files
app.py
CHANGED
|
@@ -26,10 +26,11 @@ def process_video(video_file, progress=gr.Progress()):
|
|
| 26 |
video_table.insert([{'video': video_file.name}])
|
| 27 |
|
| 28 |
progress(0.4, desc="Creating embedding index...")
|
| 29 |
-
#
|
| 30 |
frames_view.add_embedding_index(
|
| 31 |
'frame',
|
| 32 |
-
|
|
|
|
| 33 |
)
|
| 34 |
|
| 35 |
progress(1.0, desc="Processing complete")
|
|
@@ -51,10 +52,10 @@ def similarity_search(query, search_type, num_results, progress=gr.Progress()):
|
|
| 51 |
return [row['frame'] for row in results]
|
| 52 |
|
| 53 |
# Gradio interface
|
| 54 |
-
with gr.Blocks(
|
| 55 |
gr.Markdown(
|
| 56 |
"""
|
| 57 |
-
<div style=
|
| 58 |
<img src="https://raw.githubusercontent.com/pixeltable/pixeltable/main/docs/resources/pixeltable-logo-large.png" alt="Pixeltable" style="max-width: 150px;" />
|
| 59 |
<h2>Text and Image similarity search on video frames with embedding indexes</h2>
|
| 60 |
</div>
|
|
@@ -134,4 +135,5 @@ with gr.Blocks(theme=gr.themes.Base()) as demo:
|
|
| 134 |
)
|
| 135 |
|
| 136 |
if __name__ == "__main__":
|
| 137 |
-
|
|
|
|
|
|
| 26 |
video_table.insert([{'video': video_file.name}])
|
| 27 |
|
| 28 |
progress(0.4, desc="Creating embedding index...")
|
| 29 |
+
# Fixed parameter names for the embedding index
|
| 30 |
frames_view.add_embedding_index(
|
| 31 |
'frame',
|
| 32 |
+
image_embed=clip.using(model_id='openai/clip-vit-base-patch32'),
|
| 33 |
+
string_embed=clip.using(model_id='openai/clip-vit-base-patch32')
|
| 34 |
)
|
| 35 |
|
| 36 |
progress(1.0, desc="Processing complete")
|
|
|
|
| 52 |
return [row['frame'] for row in results]
|
| 53 |
|
| 54 |
# Gradio interface
|
| 55 |
+
with gr.Blocks() as demo:
|
| 56 |
gr.Markdown(
|
| 57 |
"""
|
| 58 |
+
<div style="margin-bottom: 20px;">
|
| 59 |
<img src="https://raw.githubusercontent.com/pixeltable/pixeltable/main/docs/resources/pixeltable-logo-large.png" alt="Pixeltable" style="max-width: 150px;" />
|
| 60 |
<h2>Text and Image similarity search on video frames with embedding indexes</h2>
|
| 61 |
</div>
|
|
|
|
| 135 |
)
|
| 136 |
|
| 137 |
if __name__ == "__main__":
|
| 138 |
+
# Removed theme parameter which might be causing issues
|
| 139 |
+
demo.launch()
|