Spaces:
Runtime error
Runtime error
remove unused functions
Browse files
app.py
CHANGED
@@ -14,11 +14,9 @@
|
|
14 |
# See the License for the specific language governing permissions and
|
15 |
# limitations under the License.
|
16 |
|
17 |
-
import base64
|
18 |
import traceback
|
19 |
|
20 |
import gradio as gr
|
21 |
-
import cv2
|
22 |
|
23 |
from paddlenlp import Taskflow
|
24 |
from paddlenlp.utils.doc_parser import DocParser
|
@@ -125,21 +123,6 @@ def process_upload(file):
|
|
125 |
None,
|
126 |
)
|
127 |
|
128 |
-
|
129 |
-
def BGR2RGB(img):
|
130 |
-
pilimg = img.copy()
|
131 |
-
pilimg[:, :, 0] = img[:, :, 2]
|
132 |
-
pilimg[:, :, 2] = img[:, :, 0]
|
133 |
-
return pilimg
|
134 |
-
|
135 |
-
|
136 |
-
def np2base64(image_np):
|
137 |
-
image_np = BGR2RGB(image_np)
|
138 |
-
image = cv2.imencode('.jpg', image_np)[1]
|
139 |
-
base64_str = str(base64.b64encode(image))[2:-1]
|
140 |
-
return base64_str
|
141 |
-
|
142 |
-
|
143 |
def get_schema(schema_str):
|
144 |
def _is_ch(s):
|
145 |
for ch in s:
|
|
|
14 |
# See the License for the specific language governing permissions and
|
15 |
# limitations under the License.
|
16 |
|
|
|
17 |
import traceback
|
18 |
|
19 |
import gradio as gr
|
|
|
20 |
|
21 |
from paddlenlp import Taskflow
|
22 |
from paddlenlp.utils.doc_parser import DocParser
|
|
|
123 |
None,
|
124 |
)
|
125 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
def get_schema(schema_str):
|
127 |
def _is_ch(s):
|
128 |
for ch in s:
|