Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -40,7 +40,7 @@ def calculate_md5_from_binary(binary_data):
|
|
40 |
hash_md5.update(binary_data)
|
41 |
return hash_md5.hexdigest()
|
42 |
|
43 |
-
@spaces.GPU(duration=
|
44 |
def add_pdf_gradio(pdf_file_binary, progress=gr.Progress()):
|
45 |
global model, tokenizer
|
46 |
|
@@ -84,7 +84,6 @@ def add_pdf_gradio(pdf_file_binary, progress=gr.Progress()):
|
|
84 |
|
85 |
return knowledge_base_name
|
86 |
|
87 |
-
# @spaces.GPU
|
88 |
def retrieve_gradio(knowledge_base: str, query: str, topk: int):
|
89 |
global model, tokenizer
|
90 |
|
@@ -138,6 +137,8 @@ model.to(device)
|
|
138 |
|
139 |
with gr.Blocks() as app:
|
140 |
gr.Markdown("# Memex: OCR-free Visual Document Retrieval @RhapsodyAI [RhapsodyAI/minicpm-visual-embedding-v0](https://huggingface.co/RhapsodyAI/minicpm-visual-embedding-v0)")
|
|
|
|
|
141 |
|
142 |
with gr.Row():
|
143 |
file_input = gr.File(type="binary", label="Upload PDF")
|
|
|
40 |
hash_md5.update(binary_data)
|
41 |
return hash_md5.hexdigest()
|
42 |
|
43 |
+
@spaces.GPU(duration=90)
|
44 |
def add_pdf_gradio(pdf_file_binary, progress=gr.Progress()):
|
45 |
global model, tokenizer
|
46 |
|
|
|
84 |
|
85 |
return knowledge_base_name
|
86 |
|
|
|
87 |
def retrieve_gradio(knowledge_base: str, query: str, topk: int):
|
88 |
global model, tokenizer
|
89 |
|
|
|
137 |
|
138 |
with gr.Blocks() as app:
|
139 |
gr.Markdown("# Memex: OCR-free Visual Document Retrieval @RhapsodyAI [RhapsodyAI/minicpm-visual-embedding-v0](https://huggingface.co/RhapsodyAI/minicpm-visual-embedding-v0)")
|
140 |
+
|
141 |
+
gr.Markdown("Only PDF file is available now. You are suggested to uplaod <= 50 pages per PDF, otherwise you will reach GPU time limit.")
|
142 |
|
143 |
with gr.Row():
|
144 |
file_input = gr.File(type="binary", label="Upload PDF")
|