Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -72,7 +72,9 @@ def fx6(img, lang):
|
|
72 |
def fx7(x,y):
|
73 |
res=re.findall(r'{0}'.format(y),x)
|
74 |
return res
|
75 |
-
|
|
|
|
|
76 |
|
77 |
with demo:
|
78 |
gr.Markdown(
|
@@ -107,10 +109,15 @@ with demo:
|
|
107 |
ocr_output=gr.Image(type='file', label='识别结果')
|
108 |
ocr_button = gr.Button("开始ocr识别")
|
109 |
with gr.TabItem("正则处理"):
|
110 |
-
with gr.
|
111 |
-
|
112 |
-
|
113 |
-
|
|
|
|
|
|
|
|
|
|
|
114 |
|
115 |
tj_button.click(fx1, inputs=text_input, outputs=text_output)
|
116 |
cs_button.click(fx2, inputs=val_input, outputs=json_output,api_name="ghqj")
|
@@ -119,5 +126,6 @@ with demo:
|
|
119 |
pva_button.click(fx5, inputs=[],outputs=pva_output)
|
120 |
ocr_button.click(fx6,inputs=ocr_input,outputs=ocr_output)
|
121 |
zz1_button.click(fx7,inputs=zz1_input,outputs=zz1_output)
|
|
|
122 |
|
123 |
demo.launch(enable_queue=True)
|
|
|
72 |
def fx7(x,y):
|
73 |
res=re.findall(r'{0}'.format(y),x)
|
74 |
return res
|
75 |
+
def fx8(x,y,z):
|
76 |
+
res=re.sub(r'{0}'.format(x),y,z)
|
77 |
+
return res
|
78 |
|
79 |
with demo:
|
80 |
gr.Markdown(
|
|
|
109 |
ocr_output=gr.Image(type='file', label='识别结果')
|
110 |
ocr_button = gr.Button("开始ocr识别")
|
111 |
with gr.TabItem("正则处理"):
|
112 |
+
with gr.Row():
|
113 |
+
with gr.Column():
|
114 |
+
zz1_input = [gr.Textbox(placeholder='请输入测试字符串,如"畅心语文100,数学666,英语95.7"',label="请输入测试内容"),gr.Textbox(placeholder='请输入正则表达式,如"\d+"',label="请输入正则表达式")]
|
115 |
+
zz1_output = gr.Dataframe(label="输出正则匹配数据",show_label=True)
|
116 |
+
zz1_button = gr.Button("开始正则处理>>")
|
117 |
+
with gr.Column():
|
118 |
+
zz2_input = [gr.Textbox(placeholder='输入正则表达式,如"\d+"',label="输入正则表达式"),gr.Textbox(placeholder='正则匹配对象替换为啥',label="输入替换为的字符串"),gr.Textbox(placeholder='待替换对象',label="输入原始字符串")]
|
119 |
+
zz2_output = gr.Textbox(label="输出",show_label=True)
|
120 |
+
zz2_button = gr.Button("开始正则替换>>")
|
121 |
|
122 |
tj_button.click(fx1, inputs=text_input, outputs=text_output)
|
123 |
cs_button.click(fx2, inputs=val_input, outputs=json_output,api_name="ghqj")
|
|
|
126 |
pva_button.click(fx5, inputs=[],outputs=pva_output)
|
127 |
ocr_button.click(fx6,inputs=ocr_input,outputs=ocr_output)
|
128 |
zz1_button.click(fx7,inputs=zz1_input,outputs=zz1_output)
|
129 |
+
zz2_button.click(fx8,inputs=zz1_input,outputs=zz1_output)
|
130 |
|
131 |
demo.launch(enable_queue=True)
|