Spaces:
Runtime error
Runtime error
fix: import BytesIO
Browse files
main.py
CHANGED
|
@@ -112,10 +112,6 @@ def account_classify(input, filename):
|
|
| 112 |
seq, is_confident = inference(input, model, processor, threshold=0.999, task_prompt="<s_classifier_acct>", get_confidence=True)
|
| 113 |
return seq.get('class'), is_confident
|
| 114 |
|
| 115 |
-
"""## Text processing/string matcher code"""
|
| 116 |
-
|
| 117 |
-
import locale
|
| 118 |
-
locale.getpreferredencoding = lambda: "UTF-8"
|
| 119 |
|
| 120 |
|
| 121 |
"""## Text processing/string matcher code"""
|
|
@@ -130,13 +126,12 @@ import numpy as np
|
|
| 130 |
import csv
|
| 131 |
import re
|
| 132 |
import os
|
| 133 |
-
|
| 134 |
-
|
| 135 |
import requests
|
|
|
|
| 136 |
|
| 137 |
def classify_acct_dtype_str(input_path):
|
| 138 |
-
|
| 139 |
-
ipt = Image.open(
|
| 140 |
dtype_inf, dtype_conf = doctype_classify(ipt, "city-streets.jpg")
|
| 141 |
|
| 142 |
return dtype_inf
|
|
|
|
| 112 |
seq, is_confident = inference(input, model, processor, threshold=0.999, task_prompt="<s_classifier_acct>", get_confidence=True)
|
| 113 |
return seq.get('class'), is_confident
|
| 114 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 115 |
|
| 116 |
|
| 117 |
"""## Text processing/string matcher code"""
|
|
|
|
| 126 |
import csv
|
| 127 |
import re
|
| 128 |
import os
|
|
|
|
|
|
|
| 129 |
import requests
|
| 130 |
+
from io import BytesIO
|
| 131 |
|
| 132 |
def classify_acct_dtype_str(input_path):
|
| 133 |
+
response = requests.get("https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/city-streets.jpg")
|
| 134 |
+
ipt = Image.open(BytesIO(response.content))
|
| 135 |
dtype_inf, dtype_conf = doctype_classify(ipt, "city-streets.jpg")
|
| 136 |
|
| 137 |
return dtype_inf
|