Spaces:
Sleeping
Sleeping
Add markdown to output
Browse files
app.py
CHANGED
@@ -1,25 +1,10 @@
|
|
1 |
-
import os
|
2 |
import gdown
|
3 |
import gradio as gr
|
4 |
from weaviate_explorer import WeaviateExplorer
|
5 |
|
6 |
weaviate_explorer = WeaviateExplorer()
|
7 |
-
# video_player = gr.Video(label="Search Results")
|
8 |
-
|
9 |
-
downloads_dir = "downloads" # Directory to store downloaded videos
|
10 |
-
|
11 |
-
# Create the downloads directory if it doesn't exist
|
12 |
-
os.makedirs(downloads_dir, exist_ok=True)
|
13 |
-
|
14 |
-
def remove_downloaded_videos():
|
15 |
-
"""Remove all downloaded videos from the 'downloads' directory."""
|
16 |
-
for file_name in os.listdir(downloads_dir):
|
17 |
-
file_path = os.path.join(downloads_dir, file_name)
|
18 |
-
if os.path.isfile(file_path):
|
19 |
-
os.remove(file_path)
|
20 |
|
21 |
def search(query):
|
22 |
-
# remove_downloaded_videos() # Remove previously downloaded videos
|
23 |
shorts = weaviate_explorer.explore(query)
|
24 |
download_url = f"https://drive.google.com/uc?id={shorts[0]['link'].split('/')[-2]}"
|
25 |
video_path = gdown.download(download_url, output=f"./video.mp4")
|
|
|
|
|
1 |
import gdown
|
2 |
import gradio as gr
|
3 |
from weaviate_explorer import WeaviateExplorer
|
4 |
|
5 |
weaviate_explorer = WeaviateExplorer()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
def search(query):
|
|
|
8 |
shorts = weaviate_explorer.explore(query)
|
9 |
download_url = f"https://drive.google.com/uc?id={shorts[0]['link'].split('/')[-2]}"
|
10 |
video_path = gdown.download(download_url, output=f"./video.mp4")
|