Spaces:
Sleeping
Sleeping
Videos in a row
Browse files
app.py
CHANGED
@@ -30,34 +30,32 @@ examples = [
|
|
30 |
|
31 |
def search(query):
|
32 |
shorts = weaviate_explorer.explore(query)
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
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 |
-
|
50 |
-
|
|
|
51 |
|
52 |
iface = gr.Interface(
|
53 |
fn=search,
|
54 |
inputs=input_text,
|
55 |
-
outputs=[
|
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")))
|
|
|
30 |
|
31 |
def search(query):
|
32 |
shorts = weaviate_explorer.explore(query)
|
33 |
+
videos = []
|
34 |
+
for i in range(3):
|
35 |
+
download_url = f"https://drive.google.com/uc?id={shorts[0]['link'].split('/')[-2]}"
|
36 |
+
video_path = gdown.download(download_url, output=f"./video_{i}.mp4")
|
37 |
+
videos.append(video_path)
|
38 |
+
return [gr.Video(video_path) for video_path in videos], "\n\n".join([f"- [{r['title']}]({r['link']})" for r in shorts])
|
39 |
+
|
40 |
+
title = "Slideo: Your AI-based short video search engine based on @YCombinator"
|
41 |
+
description = "Enter a search query, question or topic to receive the top 5 most relevant short video answers. The most relevant clips will be displayed separately, and they will also be included in the list of top 5 video titles with links to Google Drive."
|
|
|
|
|
|
|
|
|
|
|
42 |
|
43 |
input_text = gr.Textbox(placeholder="Your query, question, topic, ...", label="Query")
|
44 |
+
|
45 |
+
videos_row = gr.Row()
|
46 |
+
output_text = gr.Markdown(label="Top-5 relevant clips")
|
47 |
|
48 |
iface = gr.Interface(
|
49 |
fn=search,
|
50 |
inputs=input_text,
|
51 |
+
outputs=[videos_row, output_text],
|
52 |
title=title,
|
53 |
description=description,
|
54 |
examples=[[e] for e in examples],
|
55 |
cache_examples="lazy",
|
56 |
+
theme="dark-gradients",
|
57 |
+
layout="vertical",
|
58 |
)
|
59 |
|
60 |
+
iface.dependencies[0]["show_progress"] = "hidden"
|
61 |
iface.launch(auth=(os.getenv("username"), os.getenv("password")))
|