Spaces:
Runtime error
Runtime error
File size: 2,924 Bytes
8248f3e 75d64b7 8248f3e 4d62d90 a9db769 456c87c dfd47ec a9db769 57c802e 8590c5d 92f7e92 8590c5d 57c802e a9db769 f793ac8 394b9b0 f793ac8 a9db769 95a9951 c427512 8248f3e 2d677a4 4a39b12 c68fd80 4a39b12 c68fd80 2d677a4 a1efa4f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
import gradio as gr
import pandas as pd
num_dict =\
{'11':"伏位",\
'22':"伏位",\
'33':"伏位",\
'44':"伏位",\
'66':"伏位",\
'77':"伏位",\
'88':"伏位",\
'99':"伏位",\
'19':"延年",\
'26':"延年",\
'34':"延年",\
'43':"延年",\
'62':"延年",\
'78':"延年",\
'87':"延年",\
'91':"延年",\
'14':"生氣",\
'28':"生氣",\
'39':"生氣",\
'41':"生氣",\
'67':"生氣",\
'76':"生氣",\
'82':"生氣",\
'93':"生氣",\
'13':"天醫",\
'27':"天醫",\
'31':"天醫",\
'49':"天醫",\
'68':"天醫",\
'72':"天醫",\
'86':"天醫",\
'94':"天醫",\
'17':"禍害",\
'23':"禍害",\
'32':"禍害",\
'46':"禍害",\
'64':"禍害",\
'71':"禍害",\
'89':"禍害",\
'98':"禍害",\
'16':"六煞",\
'29':"六煞",\
'38':"六煞",\
'47':"六煞",\
'61':"六煞",\
'74':"六煞",\
'83':"六煞",\
'92':"六煞",\
'12':"絕命",\
'21':"絕命",\
'37':"絕命",\
'48':"絕命",\
'69':"絕命",\
'73':"絕命",\
'84':"絕命",\
'96':"絕命",\
'18':"五鬼",\
'24':"五鬼",\
'36':"五鬼",\
'42':"五鬼",\
'63':"五鬼",\
'79':"五鬼",\
'81':"五鬼",\
'97':"五鬼"}
alp_dict={\
'A':'01',
'B':'02',
'C':'03',
'D':'04',
'E':'05',
'F':'06',
'G':'07',
'H':'08',
'I':'09',
'J':'10',
'K':'11',
'L':'12',
'M':'13',
'N':'14',
'O':'15',
'P':'16',
'Q':'17',
'R':'18',
'S':'19',
'T':'20',
'U':'21',
'V':'22',
'W':'23',
'X':'24',
'Y':'25',
'Z':'26'}
def chg_number(Input):
x_text=str(Input).upper().replace(" ","").rstrip()
for i,j in alp_dict.items():
x_text=x_text.replace(i,j)
w=0
while w < len(x_text):
if x_text[w]!='0':
if w == 0:
x_text=x_text
else:
x_text=x_text[w-1:]
break
w=w+1
if x_text[0]=='5' or\
x_text[0]=='0':
x_text=x_text[1]+x_text[1:]
if x_text[-1]=='5' or\
x_text[-1]=='0':
x_text=x_text[0:-1]+x_text[-2]
x_text=x_text.replace('951',"9#1")
x_text=x_text.replace('159',"1#9")
x_text=x_text.replace('5',"")
for i in range(0,len(x_text)-1):
if x_text[i]=='0':
x_text=x_text[:i]+x_text[i-1]+x_text[i+1:]
chg_dict={}
for i in range(0,len(x_text)-1):
temp_x=x_text[i:i+2]
if temp_x=='9#':
temp_x='91'
elif temp_x=='#9':
temp_x='19'
elif temp_x=='1#':
temp_x='19'
elif temp_x=='#1':
temp_x='91'
else:
temp_x=temp_x
chg_dict[i]=[temp_x,num_dict[str(temp_x)]]
text="數字"+" "+"對應\n"
for key, value in chg_dict.items():
text=text+value[0]+" "+value[1]+"\n"
return text
demo = gr.Interface(
fn=chg_number,
inputs=gr.Textbox(lines=2, placeholder="英文或數字"),
outputs="text",
title="人生的易經數字",
description="輸人英文及數字尋找對應的吉星和凶星",
)
demo.launch()
|