Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -378,7 +378,7 @@ pdf_cache = {
|
|
| 378 |
"is_parsed": False,
|
| 379 |
"results": []
|
| 380 |
}
|
| 381 |
-
@spaces.GPU(duration=
|
| 382 |
def inference(image: Image.Image, prompt: str, max_new_tokens: int = 24000) -> str:
|
| 383 |
"""Run inference on an image with the given prompt"""
|
| 384 |
try:
|
|
@@ -451,7 +451,7 @@ def inference(image: Image.Image, prompt: str, max_new_tokens: int = 24000) -> s
|
|
| 451 |
return f"Error during inference: {str(e)}"
|
| 452 |
|
| 453 |
|
| 454 |
-
@spaces.GPU()
|
| 455 |
def _generate_text_and_confidence_for_crop(
|
| 456 |
image: Image.Image,
|
| 457 |
max_new_tokens: int = 128,
|
|
@@ -981,7 +981,7 @@ def create_gradio_interface():
|
|
| 981 |
return table_data
|
| 982 |
|
| 983 |
# Event handlers
|
| 984 |
-
@spaces.GPU()
|
| 985 |
def process_document(file_path, max_tokens, min_pix, max_pix):
|
| 986 |
"""Process the uploaded document"""
|
| 987 |
global pdf_cache
|
|
|
|
| 378 |
"is_parsed": False,
|
| 379 |
"results": []
|
| 380 |
}
|
| 381 |
+
@spaces.GPU(duration=300)
|
| 382 |
def inference(image: Image.Image, prompt: str, max_new_tokens: int = 24000) -> str:
|
| 383 |
"""Run inference on an image with the given prompt"""
|
| 384 |
try:
|
|
|
|
| 451 |
return f"Error during inference: {str(e)}"
|
| 452 |
|
| 453 |
|
| 454 |
+
@spaces.GPU(duration=300)
|
| 455 |
def _generate_text_and_confidence_for_crop(
|
| 456 |
image: Image.Image,
|
| 457 |
max_new_tokens: int = 128,
|
|
|
|
| 981 |
return table_data
|
| 982 |
|
| 983 |
# Event handlers
|
| 984 |
+
@spaces.GPU(duration=240)
|
| 985 |
def process_document(file_path, max_tokens, min_pix, max_pix):
|
| 986 |
"""Process the uploaded document"""
|
| 987 |
global pdf_cache
|