Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -80,20 +80,7 @@ def process_input(input_type, user_input, uploaded_file):
|
|
80 |
return user_input
|
81 |
else:
|
82 |
return "无效的输入类型或未上传文件。"
|
83 |
-
|
84 |
-
print('ooooocr')
|
85 |
-
if input_type == "File Upload" and uploaded_file is not None:
|
86 |
-
# 读取上传的文件
|
87 |
-
with open(uploaded_file.name, "rb") as f:
|
88 |
-
image = f.read()
|
89 |
-
results = reader.readtext(image)
|
90 |
-
# 提取识别的文本
|
91 |
-
extracted_text = ' '.join([text[1] for text in results])
|
92 |
-
print("提取的文本:")
|
93 |
-
print(extracted_text)
|
94 |
-
return extracted_text
|
95 |
-
elif input_type == "Text Input":
|
96 |
-
return user_input
|
97 |
|
98 |
def toggle_visibility(input_type):
|
99 |
user_input_visible = input_type == "Text Input"
|
|
|
80 |
return user_input
|
81 |
else:
|
82 |
return "无效的输入类型或未上传文件。"
|
83 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
|
85 |
def toggle_visibility(input_type):
|
86 |
user_input_visible = input_type == "Text Input"
|