Spaces:
Runtime error
Runtime error
freQuensy23
commited on
Commit
•
22865c0
1
Parent(s):
0870e52
[IMP] update files to backward compatability
Browse files
app.py
CHANGED
@@ -28,7 +28,8 @@ retriever = None
|
|
28 |
def handle_files_and_query(query, files, chunk_overlap=50, token_per_chunk=256, bm_25_answers=200, translate_to_ru=False):
|
29 |
results = ""
|
30 |
global prev_files, retriever
|
31 |
-
|
|
|
32 |
if files is not None and files != prev_files:
|
33 |
documents = []
|
34 |
prev_files = files
|
@@ -70,7 +71,7 @@ interface = gr.Interface(
|
|
70 |
fn=handle_files_and_query,
|
71 |
inputs=[
|
72 |
gr.Textbox(lines=1, label="Enter your search query here..."),
|
73 |
-
gr.File(file_count="multiple", type="
|
74 |
gr.Slider(minimum=1, maximum=100, value=50, label="Chunk Overlap"),
|
75 |
gr.Slider(minimum=64, maximum=512, value=256, label="Tokens Per Chunk (чем больше - тем бОльшие куски книги "
|
76 |
"сможем находить)"),
|
|
|
28 |
def handle_files_and_query(query, files, chunk_overlap=50, token_per_chunk=256, bm_25_answers=200, translate_to_ru=False):
|
29 |
results = ""
|
30 |
global prev_files, retriever
|
31 |
+
if not (isinstance(files, str) or isinstance(files[0], str)):
|
32 |
+
files = [f.name for f in files]
|
33 |
if files is not None and files != prev_files:
|
34 |
documents = []
|
35 |
prev_files = files
|
|
|
71 |
fn=handle_files_and_query,
|
72 |
inputs=[
|
73 |
gr.Textbox(lines=1, label="Enter your search query here..."),
|
74 |
+
gr.File(file_count="multiple", type="filepath", file_types=[".pdf"], label="Upload a file here."),
|
75 |
gr.Slider(minimum=1, maximum=100, value=50, label="Chunk Overlap"),
|
76 |
gr.Slider(minimum=64, maximum=512, value=256, label="Tokens Per Chunk (чем больше - тем бОльшие куски книги "
|
77 |
"сможем находить)"),
|