Spaces:
Runtime error
Runtime error
Commit
·
69d0bef
1
Parent(s):
d8b2372
Update app.py
Browse files
app.py
CHANGED
@@ -50,6 +50,23 @@ from langchain.schema import Document
|
|
50 |
import gradio as gr
|
51 |
import tempfile
|
52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
|
54 |
|
55 |
def load_model():
|
@@ -340,22 +357,7 @@ def retrieve_bot_answer(query):
|
|
340 |
# from your_module import load_model, set_custom_prompt, set_custom_prompt_condense, create_vector_database, retrieve_bot_answer
|
341 |
|
342 |
def main():
|
343 |
-
|
344 |
-
".csv": (CSVLoader, {"encoding": "utf-8"}),
|
345 |
-
".doc": (UnstructuredWordDocumentLoader, {}),
|
346 |
-
".docx": (UnstructuredWordDocumentLoader, {}),
|
347 |
-
".epub": (UnstructuredEPubLoader, {}),
|
348 |
-
".html": (UnstructuredHTMLLoader, {}),
|
349 |
-
".md": (UnstructuredMarkdownLoader, {}),
|
350 |
-
".odt": (UnstructuredODTLoader, {}),
|
351 |
-
".pdf": (PyPDFLoader, {}),
|
352 |
-
".ppt": (UnstructuredPowerPointLoader, {}),
|
353 |
-
".pptx": (UnstructuredPowerPointLoader, {}),
|
354 |
-
".txt": (TextLoader, {"encoding": "utf8"}),
|
355 |
-
".ipynb": (NotebookLoader, {}),
|
356 |
-
".py": (PythonLoader, {}),
|
357 |
-
# Add more mappings for other file extensions and loaders as needed
|
358 |
-
}
|
359 |
st.title("Docuverse")
|
360 |
|
361 |
# Upload files
|
|
|
50 |
import gradio as gr
|
51 |
import tempfile
|
52 |
|
53 |
+
FILE_LOADER_MAPPING = {
|
54 |
+
".csv": (CSVLoader, {"encoding": "utf-8"}),
|
55 |
+
".doc": (UnstructuredWordDocumentLoader, {}),
|
56 |
+
".docx": (UnstructuredWordDocumentLoader, {}),
|
57 |
+
".epub": (UnstructuredEPubLoader, {}),
|
58 |
+
".html": (UnstructuredHTMLLoader, {}),
|
59 |
+
".md": (UnstructuredMarkdownLoader, {}),
|
60 |
+
".odt": (UnstructuredODTLoader, {}),
|
61 |
+
".pdf": (PyPDFLoader, {}),
|
62 |
+
".ppt": (UnstructuredPowerPointLoader, {}),
|
63 |
+
".pptx": (UnstructuredPowerPointLoader, {}),
|
64 |
+
".txt": (TextLoader, {"encoding": "utf8"}),
|
65 |
+
".ipynb": (NotebookLoader, {}),
|
66 |
+
".py": (PythonLoader, {}),
|
67 |
+
# Add more mappings for other file extensions and loaders as needed
|
68 |
+
}
|
69 |
+
|
70 |
|
71 |
|
72 |
def load_model():
|
|
|
357 |
# from your_module import load_model, set_custom_prompt, set_custom_prompt_condense, create_vector_database, retrieve_bot_answer
|
358 |
|
359 |
def main():
|
360 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
361 |
st.title("Docuverse")
|
362 |
|
363 |
# Upload files
|