Spaces:
Running on Zero
Running on Zero
Upload app.py
Browse files
app.py
CHANGED
|
@@ -21,6 +21,11 @@ subprocess.run(
|
|
| 21 |
check=True,
|
| 22 |
)
|
| 23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
# ---------------------------------------------------------------------------
|
| 25 |
# Plugin registration
|
| 26 |
# ---------------------------------------------------------------------------
|
|
@@ -60,7 +65,6 @@ BaseFactory.load_from_plugins = _load_with_pp_doc_layout
|
|
| 60 |
|
| 61 |
# ---------------------------------------------------------------------------
|
| 62 |
import gradio as gr
|
| 63 |
-
import spaces
|
| 64 |
from docling.datamodel.base_models import InputFormat
|
| 65 |
from docling.document_converter import DocumentConverter, PdfFormatOption
|
| 66 |
from docling.datamodel.pipeline_options import PdfPipelineOptions
|
|
|
|
| 21 |
check=True,
|
| 22 |
)
|
| 23 |
|
| 24 |
+
# `spaces` MUST be imported before any package that touches CUDA (torch,
|
| 25 |
+
# transformers, docling …). ZeroGPU intercepts the CUDA initialisation; if
|
| 26 |
+
# anything else triggers it first the import raises RuntimeError.
|
| 27 |
+
import spaces # noqa: E402
|
| 28 |
+
|
| 29 |
# ---------------------------------------------------------------------------
|
| 30 |
# Plugin registration
|
| 31 |
# ---------------------------------------------------------------------------
|
|
|
|
| 65 |
|
| 66 |
# ---------------------------------------------------------------------------
|
| 67 |
import gradio as gr
|
|
|
|
| 68 |
from docling.datamodel.base_models import InputFormat
|
| 69 |
from docling.document_converter import DocumentConverter, PdfFormatOption
|
| 70 |
from docling.datamodel.pipeline_options import PdfPipelineOptions
|