Spaces:
Runtime error
Runtime error
changes to app.py
Browse files
app.py
CHANGED
@@ -2,6 +2,7 @@ import os
|
|
2 |
import sys
|
3 |
import yaml
|
4 |
import gradio as gr
|
|
|
5 |
|
6 |
current_dir = os.path.dirname(os.path.abspath(__file__))
|
7 |
|
@@ -34,7 +35,8 @@ def process_documents(files, collection_name, document_retrieval, vectorstore, c
|
|
34 |
_, _, text_chunks = parse_doc_universal(doc=files)
|
35 |
print(text_chunks)
|
36 |
embeddings = document_retrieval.load_embedding_model()
|
37 |
-
|
|
|
38 |
vectorstore = document_retrieval.create_vector_store(text_chunks, embeddings, output_db=save_location, collection_name=collection_name)
|
39 |
document_retrieval.init_retriever(vectorstore)
|
40 |
conversation_chain = document_retrieval.get_qa_retrieval_chain()
|
@@ -67,7 +69,7 @@ with gr.Blocks() as demo:
|
|
67 |
|
68 |
gr.Markdown("Powered by LLama3.1-8B-Instruct on SambaNova Cloud. Get your API key [here](https://cloud.sambanova.ai/apis).")
|
69 |
|
70 |
-
api_key = gr.Textbox(label="API Key", type="password", placeholder="(Optional) Enter your API key here for more availability")
|
71 |
|
72 |
# Step 1: Add PDF file
|
73 |
gr.Markdown("## 1️⃣ Upload PDF")
|
|
|
2 |
import sys
|
3 |
import yaml
|
4 |
import gradio as gr
|
5 |
+
from datetime import datetime
|
6 |
|
7 |
current_dir = os.path.dirname(os.path.abspath(__file__))
|
8 |
|
|
|
35 |
_, _, text_chunks = parse_doc_universal(doc=files)
|
36 |
print(text_chunks)
|
37 |
embeddings = document_retrieval.load_embedding_model()
|
38 |
+
timestamp = datetime.now().strftime("%Y%m%d%H%M%S")
|
39 |
+
collection_name = 'ekr_default_collection' + "-" + timestamp
|
40 |
vectorstore = document_retrieval.create_vector_store(text_chunks, embeddings, output_db=save_location, collection_name=collection_name)
|
41 |
document_retrieval.init_retriever(vectorstore)
|
42 |
conversation_chain = document_retrieval.get_qa_retrieval_chain()
|
|
|
69 |
|
70 |
gr.Markdown("Powered by LLama3.1-8B-Instruct on SambaNova Cloud. Get your API key [here](https://cloud.sambanova.ai/apis).")
|
71 |
|
72 |
+
#api_key = gr.Textbox(label="API Key", type="password", placeholder="(Optional) Enter your API key here for more availability")
|
73 |
|
74 |
# Step 1: Add PDF file
|
75 |
gr.Markdown("## 1️⃣ Upload PDF")
|