Spaces:
Running
Running
Lint + black action (#11)
Browse files* lint + add black in github actions
- .github/workflows/pull_request.yaml +17 -0
- embed_documents.py +5 -1
- gradio_app.py +1 -0
- markdown_parser.py +2 -1
.github/workflows/pull_request.yaml
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: lint
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
pull_request:
|
| 5 |
+
branches:
|
| 6 |
+
- '*'
|
| 7 |
+
|
| 8 |
+
jobs:
|
| 9 |
+
tests:
|
| 10 |
+
runs-on: ubuntu-latest
|
| 11 |
+
steps:
|
| 12 |
+
- name: Check out repository code
|
| 13 |
+
uses: actions/checkout@v3
|
| 14 |
+
- name: black linter
|
| 15 |
+
uses: psf/black@stable
|
| 16 |
+
with:
|
| 17 |
+
options: "--check --diff"
|
embed_documents.py
CHANGED
|
@@ -12,7 +12,11 @@ if __name__ == "__main__":
|
|
| 12 |
df = df.dropna()
|
| 13 |
print(f"after drop: {len(df)}")
|
| 14 |
|
| 15 |
-
dm = DeepLakeDocumentsManager(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
dm.batch_add(df)
|
| 17 |
zipped_file_path = dm.to_zip()
|
| 18 |
print(f"Contents zipped to: {zipped_file_path}")
|
|
|
|
| 12 |
df = df.dropna()
|
| 13 |
print(f"after drop: {len(df)}")
|
| 14 |
|
| 15 |
+
dm = DeepLakeDocumentsManager(
|
| 16 |
+
vector_store_path,
|
| 17 |
+
overwrite=overwrite,
|
| 18 |
+
required_columns=["url", "source", "content", "title"],
|
| 19 |
+
)
|
| 20 |
dm.batch_add(df)
|
| 21 |
zipped_file_path = dm.to_zip()
|
| 22 |
print(f"Contents zipped to: {zipped_file_path}")
|
gradio_app.py
CHANGED
|
@@ -18,6 +18,7 @@ logging.basicConfig(level=logging.INFO)
|
|
| 18 |
|
| 19 |
AVAILABLE_SOURCES = ["towardsai", "wikipedia", "langchain_course"]
|
| 20 |
|
|
|
|
| 21 |
def check_auth(username: str, password: str) -> bool:
|
| 22 |
valid_user = username == cfg.USERNAME
|
| 23 |
valid_password = password == cfg.PASSWORD
|
|
|
|
| 18 |
|
| 19 |
AVAILABLE_SOURCES = ["towardsai", "wikipedia", "langchain_course"]
|
| 20 |
|
| 21 |
+
|
| 22 |
def check_auth(username: str, password: str) -> bool:
|
| 23 |
valid_user = username == cfg.USERNAME
|
| 24 |
valid_password = password == cfg.PASSWORD
|
markdown_parser.py
CHANGED
|
@@ -70,9 +70,10 @@ if __name__ == "__main__":
|
|
| 70 |
|
| 71 |
chunks = []
|
| 72 |
|
| 73 |
-
from tqdm import tqdm
|
| 74 |
import json
|
| 75 |
|
|
|
|
|
|
|
| 76 |
with open("title_link_langchaincourse.json", "r") as f:
|
| 77 |
title_link_data = json.load(f)
|
| 78 |
|
|
|
|
| 70 |
|
| 71 |
chunks = []
|
| 72 |
|
|
|
|
| 73 |
import json
|
| 74 |
|
| 75 |
+
from tqdm import tqdm
|
| 76 |
+
|
| 77 |
with open("title_link_langchaincourse.json", "r") as f:
|
| 78 |
title_link_data = json.load(f)
|
| 79 |
|