Update app.py
Browse files
app.py
CHANGED
@@ -31,7 +31,7 @@ gemini_embedding_model = GeminiEmbedding(api_key=api_key, model_name="models/emb
|
|
31 |
Settings.llm = llm
|
32 |
Settings.embed_model = gemini_embedding_model
|
33 |
|
34 |
-
|
35 |
|
36 |
def extract_web(url):
|
37 |
web_documents = SimpleWebPageReader().load_data(
|
@@ -90,16 +90,15 @@ def infer(message:str, history: list):
|
|
90 |
|
91 |
if files_list:
|
92 |
documents, option = extract_doc(files_list)
|
|
|
93 |
else:
|
94 |
if message["text"].startswith("http://") or message["text"].startswith("https://"):
|
95 |
documents, option = extract_web(message["text"])
|
|
|
96 |
elif not message["text"].startswith("http://") and not message["text"].startswith("https://") and len(history) == 0:
|
97 |
gr.Error("Please input an url or upload file at first.")
|
98 |
|
99 |
|
100 |
-
print(documents)
|
101 |
-
db_path = create_col(documents)
|
102 |
-
|
103 |
# Load from disk
|
104 |
load_client = chromadb.PersistentClient(path=db_path)
|
105 |
|
|
|
31 |
Settings.llm = llm
|
32 |
Settings.embed_model = gemini_embedding_model
|
33 |
|
34 |
+
db_path=""
|
35 |
|
36 |
def extract_web(url):
|
37 |
web_documents = SimpleWebPageReader().load_data(
|
|
|
90 |
|
91 |
if files_list:
|
92 |
documents, option = extract_doc(files_list)
|
93 |
+
db_path = create_col(documents)
|
94 |
else:
|
95 |
if message["text"].startswith("http://") or message["text"].startswith("https://"):
|
96 |
documents, option = extract_web(message["text"])
|
97 |
+
db_path = create_col(documents)
|
98 |
elif not message["text"].startswith("http://") and not message["text"].startswith("https://") and len(history) == 0:
|
99 |
gr.Error("Please input an url or upload file at first.")
|
100 |
|
101 |
|
|
|
|
|
|
|
102 |
# Load from disk
|
103 |
load_client = chromadb.PersistentClient(path=db_path)
|
104 |
|