Spaces:
Sleeping
Sleeping
Commit
·
edb94bf
1
Parent(s):
f835ebc
Update gitignore and cleanup files
Browse files- .gitignore +2 -0
- README.md.bak +37 -0
- hf_login.py +2 -0
- huggingface-cli +0 -0
- upload_to_hub.py +41 -0
.gitignore
CHANGED
@@ -35,6 +35,7 @@ MANIFEST
|
|
35 |
*.zip
|
36 |
*.pt
|
37 |
*.pptx
|
|
|
38 |
|
39 |
|
40 |
# PyInstaller
|
@@ -169,3 +170,4 @@ cython_debug/
|
|
169 |
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
170 |
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
171 |
#.idea/
|
|
|
|
35 |
*.zip
|
36 |
*.pt
|
37 |
*.pptx
|
38 |
+
*.pdf
|
39 |
|
40 |
|
41 |
# PyInstaller
|
|
|
170 |
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
171 |
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
172 |
#.idea/
|
173 |
+
OshoBooks-all-books/
|
README.md.bak
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Ask Osho - Question Answering System
|
2 |
+
|
3 |
+
This is a Streamlit application that allows users to ask questions and receive answers from Osho's teachings. The application uses a vector database of Osho's books to find relevant passages and provide meaningful answers.
|
4 |
+
|
5 |
+
## Features
|
6 |
+
|
7 |
+
- Ask questions about Osho's teachings
|
8 |
+
- Choose from example questions or ask your own
|
9 |
+
- Get answers with references to specific books
|
10 |
+
- Clean and intuitive user interface
|
11 |
+
- Additional book recommendations for further reading
|
12 |
+
|
13 |
+
## How it Works
|
14 |
+
|
15 |
+
The application uses:
|
16 |
+
- Sentence transformers for text embeddings
|
17 |
+
- ChromaDB for vector similarity search
|
18 |
+
- Streamlit for the user interface
|
19 |
+
|
20 |
+
## Usage
|
21 |
+
|
22 |
+
1. Select an example question or type your own
|
23 |
+
2. Click "Please Answer Osho"
|
24 |
+
3. View the answer and book references
|
25 |
+
|
26 |
+
## Development
|
27 |
+
|
28 |
+
To run this application locally:
|
29 |
+
|
30 |
+
```bash
|
31 |
+
pip install -r requirements.txt
|
32 |
+
streamlit run streamlit_app.py
|
33 |
+
```
|
34 |
+
|
35 |
+
## Deployment
|
36 |
+
|
37 |
+
This application is deployed on Hugging Face Spaces.
|
hf_login.py
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
from huggingface_hub import login
|
2 |
+
login()
|
huggingface-cli
ADDED
File without changes
|
upload_to_hub.py
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from huggingface_hub import HfApi, create_repo
|
2 |
+
import os
|
3 |
+
import shutil
|
4 |
+
|
5 |
+
def upload_to_hub():
|
6 |
+
# Initialize the Hugging Face API
|
7 |
+
api = HfApi()
|
8 |
+
|
9 |
+
# Your Hugging Face info
|
10 |
+
repo_id = "harithapliyal/osho-vector-db"
|
11 |
+
|
12 |
+
# Create the dataset repository if it doesn't exist
|
13 |
+
try:
|
14 |
+
print("Creating dataset repository...")
|
15 |
+
create_repo(
|
16 |
+
repo_id=repo_id,
|
17 |
+
repo_type="dataset",
|
18 |
+
private=False
|
19 |
+
)
|
20 |
+
print("Dataset repository created successfully!")
|
21 |
+
except Exception as e:
|
22 |
+
print(f"Note: {str(e)}")
|
23 |
+
|
24 |
+
# Local vector database path
|
25 |
+
local_db_path = os.path.join(os.getcwd(), "vector_db")
|
26 |
+
|
27 |
+
print(f"Uploading vector database from {local_db_path}")
|
28 |
+
|
29 |
+
try:
|
30 |
+
# Upload the entire directory
|
31 |
+
api.upload_folder(
|
32 |
+
folder_path=local_db_path,
|
33 |
+
repo_id=repo_id,
|
34 |
+
repo_type="dataset"
|
35 |
+
)
|
36 |
+
print("Successfully uploaded vector database to Hugging Face!")
|
37 |
+
except Exception as e:
|
38 |
+
print(f"Error uploading to Hugging Face: {str(e)}")
|
39 |
+
|
40 |
+
if __name__ == "__main__":
|
41 |
+
upload_to_hub()
|