Spaces:
Paused
Paused
updated installations
Browse files
app.py
CHANGED
@@ -1,3 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
# import fitz # PyMuPDF for extracting text from PDFs
|
3 |
from langchain.embeddings import HuggingFaceEmbeddings
|
@@ -12,14 +22,7 @@ import re
|
|
12 |
import transformers
|
13 |
from torch import bfloat16
|
14 |
from langchain_community.document_loaders import DirectoryLoader
|
15 |
-
# import subprocess
|
16 |
-
import os
|
17 |
-
# # Run setup.sh script before starting the app
|
18 |
-
# subprocess.run(["/bin/bash", "setup.sh"], check=True)
|
19 |
|
20 |
-
os.system('apt-get update && apt-get install -y libmagic1')
|
21 |
-
os.system('pip install accelerate')
|
22 |
-
os.system('pip install -i https://pypi.org/simple/ bitsandbytes')
|
23 |
# Initialize embeddings and ChromaDB
|
24 |
model_name = "sentence-transformers/all-mpnet-base-v2"
|
25 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
|
1 |
+
# import subprocess
|
2 |
+
import os
|
3 |
+
# # Run setup.sh script before starting the app
|
4 |
+
# subprocess.run(["/bin/bash", "setup.sh"], check=True)
|
5 |
+
|
6 |
+
os.system('apt-get update && apt-get install -y libmagic1')
|
7 |
+
os.system('pip install accelerate')
|
8 |
+
os.system('pip install -i https://pypi.org/simple/ bitsandbytes')
|
9 |
+
|
10 |
+
|
11 |
import gradio as gr
|
12 |
# import fitz # PyMuPDF for extracting text from PDFs
|
13 |
from langchain.embeddings import HuggingFaceEmbeddings
|
|
|
22 |
import transformers
|
23 |
from torch import bfloat16
|
24 |
from langchain_community.document_loaders import DirectoryLoader
|
|
|
|
|
|
|
|
|
25 |
|
|
|
|
|
|
|
26 |
# Initialize embeddings and ChromaDB
|
27 |
model_name = "sentence-transformers/all-mpnet-base-v2"
|
28 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|