freQuensy23 commited on
Commit
d9d3e0b
1 Parent(s): 9233e07
Files changed (1) hide show
  1. app.py +2 -11
app.py CHANGED
@@ -1,13 +1,4 @@
1
- import warnings
2
-
3
- from langchain_core._api import LangChainDeprecationWarning
4
-
5
  import translator
6
-
7
- warnings.filterwarnings("ignore", category=DeprecationWarning)
8
- warnings.filterwarnings("ignore", category=UserWarning)
9
- warnings.filterwarnings("ignore", category=LangChainDeprecationWarning)
10
-
11
  from langchain_community.document_loaders import PyMuPDFLoader
12
  from langchain.text_splitter import SentenceTransformersTokenTextSplitter
13
  from langchain_community.embeddings import SentenceTransformerEmbeddings
@@ -20,7 +11,7 @@ import re
20
  print('All imports are successful')
21
 
22
  model = "msmarco-distilbert-base-tas-b"
23
- embeddings = SentenceTransformerEmbeddings(model_name=model)
24
  prev_files = None
25
  retriever = None
26
 
@@ -69,7 +60,7 @@ interface = gr.Interface(
69
  fn=handle_files_and_query,
70
  inputs=[
71
  gr.Textbox(lines=1, label="Enter your search query here..."),
72
- gr.File(file_count="multiple", type="filepath", file_types=[".pdf"], label="Upload a file here."),
73
  gr.Slider(minimum=1, maximum=100, value=50, label="Chunk Overlap"),
74
  gr.Slider(minimum=64, maximum=512, value=256, label="Tokens Per Chunk (чем больше - тем бОльшие куски книги "
75
  "сможем находить)"),
 
 
 
 
 
1
  import translator
 
 
 
 
 
2
  from langchain_community.document_loaders import PyMuPDFLoader
3
  from langchain.text_splitter import SentenceTransformersTokenTextSplitter
4
  from langchain_community.embeddings import SentenceTransformerEmbeddings
 
11
  print('All imports are successful')
12
 
13
  model = "msmarco-distilbert-base-tas-b"
14
+ embeddings = SentenceTransformerEmbeddings(model_name=model, resume_download=True)
15
  prev_files = None
16
  retriever = None
17
 
 
60
  fn=handle_files_and_query,
61
  inputs=[
62
  gr.Textbox(lines=1, label="Enter your search query here..."),
63
+ gr.File(file_count="multiple", type="file", file_types=[".pdf"], label="Upload a file here."),
64
  gr.Slider(minimum=1, maximum=100, value=50, label="Chunk Overlap"),
65
  gr.Slider(minimum=64, maximum=512, value=256, label="Tokens Per Chunk (чем больше - тем бОльшие куски книги "
66
  "сможем находить)"),