Spaces:
Runtime error
Runtime error
fix device cuda if available
Browse files
app.py
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
import PIL.Image
|
2 |
import gradio as gr
|
3 |
-
|
4 |
import numpy as np
|
5 |
from craft_text_detector import Craft
|
6 |
|
7 |
-
craft = Craft(output_dir='output', crop_type="box", cuda=
|
8 |
|
9 |
dw=0.3
|
10 |
dh=0.25
|
@@ -51,7 +51,7 @@ def detect(image: PIL.Image.Image):
|
|
51 |
|
52 |
def process(image:PIL.Image.Image):
|
53 |
if image is None:
|
54 |
-
return None,0
|
55 |
boxes,signed = detect( image)
|
56 |
annotated = PIL.Image.open('output/image_text_detection.png') # image with boxes displayed
|
57 |
return annotated, len(boxes), signed
|
|
|
1 |
import PIL.Image
|
2 |
import gradio as gr
|
3 |
+
import torch
|
4 |
import numpy as np
|
5 |
from craft_text_detector import Craft
|
6 |
|
7 |
+
craft = Craft(output_dir='output', crop_type="box", cuda=torch.cuda.is_available(), export_extra=True)
|
8 |
|
9 |
dw=0.3
|
10 |
dh=0.25
|
|
|
51 |
|
52 |
def process(image:PIL.Image.Image):
|
53 |
if image is None:
|
54 |
+
return None,0,False
|
55 |
boxes,signed = detect( image)
|
56 |
annotated = PIL.Image.open('output/image_text_detection.png') # image with boxes displayed
|
57 |
return annotated, len(boxes), signed
|