Spaces:
Sleeping
Sleeping
Commit ·
c3e305d
1
Parent(s): 3482395
Add app file and db
Browse files- .gitattributes +1 -0
- app.py +44 -0
- db/ae2e8ea7-7773-4180-a2df-6d16f9bcc210/data_level0.bin +3 -0
- db/ae2e8ea7-7773-4180-a2df-6d16f9bcc210/header.bin +3 -0
- db/ae2e8ea7-7773-4180-a2df-6d16f9bcc210/index_metadata.pickle +3 -0
- db/ae2e8ea7-7773-4180-a2df-6d16f9bcc210/length.bin +3 -0
- db/ae2e8ea7-7773-4180-a2df-6d16f9bcc210/link_lists.bin +3 -0
- db/chroma.sqlite3 +3 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
*.sqlite3 filter=lfs diff=lfs merge=lfs -text
|
app.py
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import chromadb
|
| 2 |
+
import os
|
| 3 |
+
import gradio as gr
|
| 4 |
+
|
| 5 |
+
client = chromadb.PersistentClient(path="./db")
|
| 6 |
+
collection = client.get_or_create_collection("test")
|
| 7 |
+
|
| 8 |
+
def query_episodes(query, n_results):
|
| 9 |
+
output = ""
|
| 10 |
+
|
| 11 |
+
q = collection.query(
|
| 12 |
+
query_texts=[query],
|
| 13 |
+
n_results=n_results)
|
| 14 |
+
|
| 15 |
+
for idx in range(n_results):
|
| 16 |
+
output += "Episode Title: {}\nParagraph: {}\nEstimated Timestamp: {}\nExcerpt: {}".format(q["metadatas"][0][idx]["title"], q["metadatas"][0][idx]["paragraph"], float(q["metadatas"][0][idx]["paragraph"]) * 1.6, q["documents"][0][idx])
|
| 17 |
+
if idx+1 < n_results:
|
| 18 |
+
output += "\n\n"
|
| 19 |
+
|
| 20 |
+
return output
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
if __name__ == "__main__":
|
| 24 |
+
description = "With a podcast like the Huberman Lab podcast it can sometimes be overwhelming trying to find the exact content you are looking for. This tool is meant to start you in the right direction depending on the topic you are searching for."
|
| 25 |
+
article = """If you like this tool and want to connect check out my [website](isteph.netlify.app)!"""
|
| 26 |
+
examples = [
|
| 27 |
+
["Stretching routine", 3],
|
| 28 |
+
["Cold exposure", 5],
|
| 29 |
+
["Handling ADHD", 2],
|
| 30 |
+
["Eating healthy", 8]
|
| 31 |
+
]
|
| 32 |
+
|
| 33 |
+
interface = gr.Interface(
|
| 34 |
+
fn=query_episodes,
|
| 35 |
+
inputs=[gr.Textbox(label="Search Query",show_label=True), gr.Slider(value=3, minimum=1, maximum=10, step=1, label="Number of Results")],
|
| 36 |
+
outputs=[gr.Textbox(label="Consolidated Query Results", show_label=True)],
|
| 37 |
+
title="Huberman Lab Podcast Topic Search",
|
| 38 |
+
examples=examples,
|
| 39 |
+
description=description,
|
| 40 |
+
article=article
|
| 41 |
+
)
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
interface.launch()
|
db/ae2e8ea7-7773-4180-a2df-6d16f9bcc210/data_level0.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2cf0b48833aa1eba8eaa208f58170ecbb3011b564eacf6df8f48967c7308a1ed
|
| 3 |
+
size 8380000
|
db/ae2e8ea7-7773-4180-a2df-6d16f9bcc210/header.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e6ed12c7e4e6ab6a5d98ddf8a1a8a25093254588c615e554386af02e96e187a2
|
| 3 |
+
size 100
|
db/ae2e8ea7-7773-4180-a2df-6d16f9bcc210/index_metadata.pickle
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c204b637049206d1b2e70e136e127bab484dcf63d6ae33050e2c7d2569047e21
|
| 3 |
+
size 136906
|
db/ae2e8ea7-7773-4180-a2df-6d16f9bcc210/length.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e01f1ccaf09863943f5c11f7bd1c3ca624350c35a92b5ae3321a8f2bf849b584
|
| 3 |
+
size 20000
|
db/ae2e8ea7-7773-4180-a2df-6d16f9bcc210/link_lists.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:85e2763a5c8336f1f35c4da617fd0dcc275a47740d30adb6e01d9851b7f22a8a
|
| 3 |
+
size 44752
|
db/chroma.sqlite3
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:68aa13098b4f3a548441ba8d34384a3254c00e77f7dab5927df11eb8a1b5d2d8
|
| 3 |
+
size 71913472
|