Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -978,7 +978,136 @@ def clear_chat():
|
|
| 978 |
|
| 979 |
|
| 980 |
|
| 981 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 982 |
|
| 983 |
|
| 984 |
|
|
|
|
| 978 |
|
| 979 |
|
| 980 |
|
| 981 |
+
# енерирует HTML код мандалы идентично JavaScript верси
|
| 982 |
+
def generate_mandala_html(pattern_array, container_id="mandala-container"):
|
| 983 |
+
"""Генерирует HTML код мандалы идентично JavaScript версии"""
|
| 984 |
+
|
| 985 |
+
def get_color_for_digit(digit):
|
| 986 |
+
color_map = {
|
| 987 |
+
'1': 'yellow', '2': 'blue', '3': 'turquoise', '4': 'pink',
|
| 988 |
+
'5': 'orange', '6': 'violet', '7': 'red', '8': 'dark_blue', '9': 'green'
|
| 989 |
+
}
|
| 990 |
+
return color_map.get(digit, 'white')
|
| 991 |
+
|
| 992 |
+
html_parts = [f'<div class="hexagon size-16" id="{container_id}">']
|
| 993 |
+
|
| 994 |
+
for side in range(1, 7):
|
| 995 |
+
html_parts.append(f'<div class="side side-{side}">')
|
| 996 |
+
|
| 997 |
+
for line in range(16):
|
| 998 |
+
if line >= len(pattern_array):
|
| 999 |
+
break
|
| 1000 |
+
|
| 1001 |
+
pattern_line = pattern_array[line]
|
| 1002 |
+
rombs_count = 16 - line
|
| 1003 |
+
html_parts.append(f'<div class="line line-{line}">')
|
| 1004 |
+
|
| 1005 |
+
for i in range(min(rombs_count, len(pattern_line))):
|
| 1006 |
+
digit = pattern_line[i]
|
| 1007 |
+
color = get_color_for_digit(digit)
|
| 1008 |
+
html_parts.append(
|
| 1009 |
+
f'<div class="romb {color}"><span>{digit}</span></div>'
|
| 1010 |
+
)
|
| 1011 |
+
|
| 1012 |
+
html_parts.append('</div>')
|
| 1013 |
+
|
| 1014 |
+
html_parts.append('</div>')
|
| 1015 |
+
|
| 1016 |
+
html_parts.append('</div>')
|
| 1017 |
+
|
| 1018 |
+
return '\n'.join(html_parts)
|
| 1019 |
+
|
| 1020 |
+
# HTML шаблон как строка
|
| 1021 |
+
MANDALA_TEMPLATE = """
|
| 1022 |
+
<!DOCTYPE html>
|
| 1023 |
+
<html>
|
| 1024 |
+
<head>
|
| 1025 |
+
<style>
|
| 1026 |
+
/* ТВОИ СТИЛИ ЗДЕСЬ */
|
| 1027 |
+
.container_top { padding-top: 30px; }
|
| 1028 |
+
.details_numbers { margin: 15px 0 0px 0; }
|
| 1029 |
+
/* ... и все остальные твои стили ... */
|
| 1030 |
+
|
| 1031 |
+
.hexagon { position: relative; width: 400px; height: 400px; }
|
| 1032 |
+
.side { position: absolute; }
|
| 1033 |
+
.line { display: flex; }
|
| 1034 |
+
.romb { width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; }
|
| 1035 |
+
|
| 1036 |
+
.yellow { background-color: yellow; }
|
| 1037 |
+
.blue { background-color: blue; color: white; }
|
| 1038 |
+
.turquoise { background-color: turquoise; }
|
| 1039 |
+
.pink { background-color: pink; }
|
| 1040 |
+
.orange { background-color: orange; }
|
| 1041 |
+
.violet { background-color: violet; }
|
| 1042 |
+
.red { background-color: red; color: white; }
|
| 1043 |
+
.dark_blue { background-color: darkblue; color: white; }
|
| 1044 |
+
.green { background-color: green; color: white; }
|
| 1045 |
+
.white { background-color: white; border: 1px solid #ccc; }
|
| 1046 |
+
</style>
|
| 1047 |
+
</head>
|
| 1048 |
+
<body>
|
| 1049 |
+
{{ mandala_html|safe }}
|
| 1050 |
+
</body>
|
| 1051 |
+
</html>
|
| 1052 |
+
"""
|
| 1053 |
+
|
| 1054 |
+
@app.route('/mandala')
|
| 1055 |
+
def show_mandala():
|
| 1056 |
+
pattern = [
|
| 1057 |
+
"577416161737624147874371687965675387455166255764767112646",
|
| 1058 |
+
"35257777811486552662718756762243826291673871341244823811",
|
| 1059 |
+
"8773555692535217838989632448467218821741268475368315292",
|
| 1060 |
+
"651811262788738622888695683314939713825385323895246722",
|
| 1061 |
+
"26992388967612584177565252645433784217824855285761494",
|
| 1062 |
+
"8692527864473743585322777819976163638616341714347544",
|
| 1063 |
+
"562779651821127844854955691974779992577975885772398",
|
| 1064 |
+
"28957626913239638349451261172257992735773474359538",
|
| 1065 |
+
"1853488614553692274496387289473792918351722785582",
|
| 1066 |
+
"948737575918962492846926918421172219286894964141",
|
| 1067 |
+
"43611333519868642131628619363289431215584461555",
|
| 1068 |
+
"7972466861855516344781571399518474336143817611",
|
| 1069 |
+
"779613557941167978269638439569322769757298472",
|
| 1070 |
+
"57674813745274776186692373526354946733928329",
|
| 1071 |
+
"3442394129792254795362511878989441416321252",
|
| 1072 |
+
"786534532772479275898762966888485557953377",
|
| 1073 |
+
"65287985959627293488648263577334113758615",
|
| 1074 |
+
"2716784555689923737513189835167524134576",
|
| 1075 |
+
"987463911258925111364498828674376547934",
|
| 1076 |
+
"86219312374827622491848711542714292737",
|
| 1077 |
+
"5831343512319484641933682696985622911",
|
| 1078 |
+
"424477863541433115136951866684284212",
|
| 1079 |
+
"66825659895576426649656953353613633",
|
| 1080 |
+
"3517225885134168314622658688974996",
|
| 1081 |
+
"868947474647575245184824557872496",
|
| 1082 |
+
"55842222112333769693316913669646",
|
| 1083 |
+
"1436444323566146663647614936611",
|
| 1084 |
+
"579188755823751339912475439372",
|
| 1085 |
+
"37197631415136463913623973319",
|
| 1086 |
+
"1817494556649119314985371641",
|
| 1087 |
+
"998244912314121345484818715",
|
| 1088 |
+
"98168413545533479933399686",
|
| 1089 |
+
"8975354899186727936639655",
|
| 1090 |
+
"873889389195499739393621",
|
| 1091 |
+
"61278328115949713333983",
|
| 1092 |
+
"7396251926544784666382",
|
| 1093 |
+
"136876128298263133921",
|
| 1094 |
+
"49564731128189446323",
|
| 1095 |
+
"4521214231998481955",
|
| 1096 |
+
"973335654198339151",
|
| 1097 |
+
"71668229518263166",
|
| 1098 |
+
"8735142569189473",
|
| 1099 |
+
"618656726198421",
|
| 1100 |
+
"79522498718363",
|
| 1101 |
+
"7574648689299",
|
| 1102 |
+
"332113558229",
|
| 1103 |
+
"65324814142",
|
| 1104 |
+
"2856395556",
|
| 1105 |
+
"142935112",
|
| 1106 |
+
"56238623"
|
| 1107 |
+
]
|
| 1108 |
+
|
| 1109 |
+
mandala_html = generate_mandala_html(pattern)
|
| 1110 |
+
return render_template_string(MANDALA_TEMPLATE, mandala_html=mandala_html)
|
| 1111 |
|
| 1112 |
|
| 1113 |
|