Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -133,7 +133,7 @@ def process_directory(directory):
|
|
| 133 |
continue
|
| 134 |
|
| 135 |
with open(file_path, 'rb') as f:
|
| 136 |
-
if file_ext in ['.rst', '.md', '.txt', '.html', '.json', '.yaml']:
|
| 137 |
text = f.read().decode('utf-8')
|
| 138 |
elif file_ext == '.pdf':
|
| 139 |
reader = PdfReader(f)
|
|
@@ -204,6 +204,8 @@ def initialize():
|
|
| 204 |
|
| 205 |
download_gitlab_repo()
|
| 206 |
all_texts, file_references = process_directory(REPOSITORY_DIRECTORY)
|
|
|
|
|
|
|
| 207 |
chunks = split_into_chunks(all_texts, file_references, CHUNK_SIZE, CHUNK_OVERLAP)
|
| 208 |
vectorstore = setup_chroma(chunks, EMBEDDING_MODEL_NAME, PERSIST_DIRECTORY)
|
| 209 |
llm = setup_llm(LLM_MODEL_NAME, LLM_TEMPERATURE, GROQ_API_KEY)
|
|
|
|
| 133 |
continue
|
| 134 |
|
| 135 |
with open(file_path, 'rb') as f:
|
| 136 |
+
if file_ext in ['.rst', '.md', '.txt', '.html', '.json', '.yaml', '.py']:
|
| 137 |
text = f.read().decode('utf-8')
|
| 138 |
elif file_ext == '.pdf':
|
| 139 |
reader = PdfReader(f)
|
|
|
|
| 204 |
|
| 205 |
download_gitlab_repo()
|
| 206 |
all_texts, file_references = process_directory(REPOSITORY_DIRECTORY)
|
| 207 |
+
for text in all_texts:
|
| 208 |
+
print(text)
|
| 209 |
chunks = split_into_chunks(all_texts, file_references, CHUNK_SIZE, CHUNK_OVERLAP)
|
| 210 |
vectorstore = setup_chroma(chunks, EMBEDDING_MODEL_NAME, PERSIST_DIRECTORY)
|
| 211 |
llm = setup_llm(LLM_MODEL_NAME, LLM_TEMPERATURE, GROQ_API_KEY)
|