Spaces:
Sleeping
Sleeping
Prathamesh1420
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -16,17 +16,12 @@ if not (llama_cloud_key and groq_key and mxbai_key):
|
|
16 |
)
|
17 |
|
18 |
# models name
|
19 |
-
llm_model_name = "
|
20 |
embed_model_name = "mixedbread-ai/mxbai-embed-large-v1"
|
21 |
|
22 |
# Initialize the parser
|
23 |
parser = LlamaParse(api_key=llama_cloud_key, result_type="markdown")
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
# Define file extractor with various common extensions
|
31 |
file_extractor = {
|
32 |
".pdf": parser,
|
@@ -48,6 +43,7 @@ file_extractor = {
|
|
48 |
embed_model = MixedbreadAIEmbedding(api_key=mxbai_key, model_name=embed_model_name)
|
49 |
|
50 |
# Initialize the LLM
|
|
|
51 |
llm = Groq(model="llama-3.1-70b-versatile", api_key=groq_key)
|
52 |
|
53 |
|
@@ -56,7 +52,7 @@ def load_files(file_path: str):
|
|
56 |
global vector_index
|
57 |
if not file_path:
|
58 |
return "No file path provided. Please upload a file."
|
59 |
-
|
60 |
valid_extensions = ', '.join(file_extractor.keys())
|
61 |
if not any(file_path.endswith(ext) for ext in file_extractor):
|
62 |
return f"The parser can only parse the following file types: {valid_extensions}"
|
|
|
16 |
)
|
17 |
|
18 |
# models name
|
19 |
+
llm_model_name = "llama-3.1-70b-versatile"
|
20 |
embed_model_name = "mixedbread-ai/mxbai-embed-large-v1"
|
21 |
|
22 |
# Initialize the parser
|
23 |
parser = LlamaParse(api_key=llama_cloud_key, result_type="markdown")
|
24 |
|
|
|
|
|
|
|
|
|
|
|
25 |
# Define file extractor with various common extensions
|
26 |
file_extractor = {
|
27 |
".pdf": parser,
|
|
|
43 |
embed_model = MixedbreadAIEmbedding(api_key=mxbai_key, model_name=embed_model_name)
|
44 |
|
45 |
# Initialize the LLM
|
46 |
+
|
47 |
llm = Groq(model="llama-3.1-70b-versatile", api_key=groq_key)
|
48 |
|
49 |
|
|
|
52 |
global vector_index
|
53 |
if not file_path:
|
54 |
return "No file path provided. Please upload a file."
|
55 |
+
|
56 |
valid_extensions = ', '.join(file_extractor.keys())
|
57 |
if not any(file_path.endswith(ext) for ext in file_extractor):
|
58 |
return f"The parser can only parse the following file types: {valid_extensions}"
|