Update app.py
Browse files
app.py
CHANGED
@@ -55,6 +55,32 @@ def xz():
|
|
55 |
x=pd.DataFrame([{'姓名':'畅心','成绩':100},{'姓名':'吹水','成绩':66}])
|
56 |
y=x.to_excel('statics/test.xlsx',index=False)
|
57 |
return 'statics/test.xlsx'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
|
59 |
'''
|
60 |
def fx_dd(tk:str,s:str):
|
@@ -163,5 +189,9 @@ py_exe=d_t.to_pandas()'''
|
|
163 |
with gr.Row():
|
164 |
xz_button=gr.Button("绑定下载资源>>")
|
165 |
xz_button.click(xz,[], gr.File(label="输出下载资源"),api_name='xz')
|
|
|
|
|
|
|
|
|
166 |
|
167 |
demo.launch()
|
|
|
55 |
x=pd.DataFrame([{'姓名':'畅心','成绩':100},{'姓名':'吹水','成绩':66}])
|
56 |
y=x.to_excel('statics/test.xlsx',index=False)
|
57 |
return 'statics/test.xlsx'
|
58 |
+
def fx_rq(date):
|
59 |
+
chinese_data_dict = {'1': '一','2': '二','3': '三','4': '四','5': '五','6': '六','7': '七','8': '八','9': '九','0': '〇'}
|
60 |
+
chinese_data2_dict = {'一': '十','二': '二十','三': '三十'}
|
61 |
+
for c in date:
|
62 |
+
if c in chinese_data_dict:
|
63 |
+
date = date.replace(c, chinese_data_dict[c])
|
64 |
+
y = date.split('-')[0]
|
65 |
+
m = date.split('-')[1]
|
66 |
+
temp = ''
|
67 |
+
if len(m) == 2:
|
68 |
+
temp += chinese_data2_dict[m[0]]
|
69 |
+
if m[1] != "〇":
|
70 |
+
temp += m[1]
|
71 |
+
m = temp
|
72 |
+
|
73 |
+
d = date.split('-')[2]
|
74 |
+
temp = ''
|
75 |
+
if len(d) == 2:
|
76 |
+
temp += chinese_data2_dict[d[0]]
|
77 |
+
if d[1] != "〇":
|
78 |
+
temp += d[1]
|
79 |
+
d = temp
|
80 |
+
|
81 |
+
date = y + '年' + m + '月' + d + '日'
|
82 |
+
return date
|
83 |
+
|
84 |
|
85 |
'''
|
86 |
def fx_dd(tk:str,s:str):
|
|
|
189 |
with gr.Row():
|
190 |
xz_button=gr.Button("绑定下载资源>>")
|
191 |
xz_button.click(xz,[], gr.File(label="输出下载资源"),api_name='xz')
|
192 |
+
with gr.TabItem("date转换"):
|
193 |
+
dt_input=gr.Textbox(label='请输入需要处理的日期字符串')
|
194 |
+
dt_button=gr.Button("转换日期>>")
|
195 |
+
dt_button.click(fx_rq,dt_input,"text",api_name='date_chinese')
|
196 |
|
197 |
demo.launch()
|