File size: 633 Bytes
c43fc2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Entry point for the free Gradio-SDK Space: Spaces run `python app.py` and route
# traffic to port 7860, so this starts docparse's own upload UI there.
import os

os.environ.setdefault("OMP_NUM_THREADS", "2")

try:  # ZeroGPU (the only free Gradio hardware) refuses to start without one
    import spaces

    @spaces.GPU
    def _unused():
        pass

    # spaces normally reports this from gr.Blocks.launch, which this app never calls
    from spaces.zero import client
    client.startup_report()
except ImportError:
    pass

from docparse.ui import serve

serve(port=7860, host="0.0.0.0", model="artifacts/docparse/ocr.pt")