Spaces:
Sleeping
Sleeping
WenqingZhang
commited on
Commit
β’
8f87303
1
Parent(s):
69856e7
Update app.py
Browse files
app.py
CHANGED
@@ -80,6 +80,20 @@ def process_input(input_type, user_input, uploaded_file):
|
|
80 |
return user_input
|
81 |
else:
|
82 |
return "ζ ζηθΎε
₯η±»εζζͺδΈδΌ ζδ»Άγ"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
|
84 |
def toggle_visibility(input_type):
|
85 |
user_input_visible = input_type == "Text Input"
|
|
|
80 |
return user_input
|
81 |
else:
|
82 |
return "ζ ζηθΎε
₯η±»εζζͺδΈδΌ ζδ»Άγ"
|
83 |
+
def process_input(input_type, user_input, uploaded_file):
|
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"
|