Spaces:
Sleeping
Sleeping
Modify
Browse files
app.py
CHANGED
@@ -30,25 +30,34 @@ examples = [
|
|
30 |
|
31 |
def search(query):
|
32 |
shorts = weaviate_explorer.explore(query)
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
|
54 |
iface.launch(auth=(os.getenv("username"), os.getenv("password")))
|
|
|
30 |
|
31 |
def search(query):
|
32 |
shorts = weaviate_explorer.explore(query)
|
33 |
+
video_paths = []
|
34 |
+
markdown_links = []
|
35 |
+
|
36 |
+
# Assuming you can get up to 3 videos
|
37 |
+
for short in shorts[:3]:
|
38 |
+
download_url = f"https://drive.google.com/uc?id={short['link'].split('/')[-2]}"
|
39 |
+
video_path = gdown.download(download_url, output=f"./video_{shorts.index(short)}.mp4")
|
40 |
+
video_paths.append(video_path)
|
41 |
+
markdown_links.append(f"- [{short['title']}]({short['link']})")
|
42 |
+
|
43 |
+
return video_paths, "\n\n".join(markdown_links)
|
44 |
+
|
45 |
+
title = "Slideo: Your AI-based short video search engine. Based on YC"
|
46 |
+
description = "Enter a search query to receive relevant short video answers."
|
47 |
+
|
48 |
+
input_text = gr.Textbox(placeholder="Your query, question, topic, ...", label="Query")
|
49 |
+
videos = [gr.Video(label=f"Clip {i+1}") for i in range(3)]
|
50 |
+
output_text = gr.Markdown(label="Relevant clips")
|
51 |
+
|
52 |
+
iface = gr.Interface(
|
53 |
+
fn=search,
|
54 |
+
inputs=input_text,
|
55 |
+
outputs=[gr.Row(videos), output_text],
|
56 |
+
title=title,
|
57 |
+
description=description,
|
58 |
+
examples=[[e] for e in examples],
|
59 |
+
cache_examples="lazy",
|
60 |
+
theme="dark"
|
61 |
+
)
|
62 |
|
63 |
iface.launch(auth=(os.getenv("username"), os.getenv("password")))
|