Compare commits

...

10 Commits

Author SHA1 Message Date
gav
a66fde985f Merge branch 'main' into text-edition
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2022-05-05 12:13:24 +07:00
f97a8286b7 Updated gitignore
All checks were successful
continuous-integration/drone/push Build is passing
2022-05-05 12:12:27 +07:00
1dfd81de31 Merge branch 'main' of https://gitea.gavt45.ru/gav/es-bot
All checks were successful
continuous-integration/drone/push Build is passing
2022-05-05 12:11:40 +07:00
20eaea722f added images and updated svc 2022-05-05 12:11:20 +07:00
ee834376db Job of fucking copywriter!!!
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2022-05-04 22:05:35 +07:00
gav
ca6ac97e33 Merge pull request 'Job of fucking copiwriter!!!' (#3) from text-edition into main
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #3
Reviewed-by: gav <a@a.aa>
2022-05-04 21:03:34 +07:00
be430673f1 Job of fucking copiwriter!!!
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2022-05-04 21:02:03 +07:00
gav
2dc6327fe1 Merge pull request 'text-edition' (#2) from text-edition into main
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #2
2022-05-04 20:44:44 +07:00
221ff51d3d Text edited
All checks were successful
continuous-integration/drone/push Build is passing
2022-05-04 20:43:53 +07:00
0fc4d0df82 Text edited
All checks were successful
continuous-integration/drone/push Build is passing
2022-05-04 19:59:59 +07:00
262 changed files with 794 additions and 41 deletions

2
.gitattributes vendored Normal file
View File

@ -0,0 +1,2 @@
*.png filter=lfs diff=lfs merge=lfs -text
*.jpg filter=lfs diff=lfs merge=lfs -text

2
.gitignore vendored
View File

@ -2,3 +2,5 @@
tmp tmp
.env .env
docker-compose-dev.yml docker-compose-dev.yml
*.DS_Store*
.idea/

BIN
img.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 184 KiB

After

Width:  |  Height:  |  Size: 131 B

View File

@ -1,20 +1,18 @@
from vkwave.bots import Keyboard, ButtonColor from vkwave.bots import Keyboard, ButtonColor
# menu # menu
MENU = """Здравствуйте, дорогие друзья Инженерной школы НГУ! MENU = """С помощью бота вы можете:
Мы создали этого бота, чтобы помочь вам ориентироваться в информации про ИШ. Вы можете:
&#9881; пройти тест и получить индивидуальный NFT-талисман, сгенерированный специально для вас нейросетью; &#9881; пройти тест и получить индивидуальный NFT-талисман, сгенерированный специально для вас нейросетью;
&#9881; вступить в чат абитуриентов, студентов и преподавателей; &#9881; вступить в чат абитуриентов, студентов и преподавателей;
&#9881; пообщаться со студентом (можно выбрать, с кем); &#9881; пообщаться со студентом (можно выбрать с кем);
&#9881; пообщаться с руководителем ИШ или преподавателем (можно выбрать, с кем); &#9881; пообщаться с руководителем ИШ или преподавателем (можно выбрать с кем)."""
Добро пожаловать!"""
MENU_KB = Keyboard() MENU_KB = Keyboard()
MENU_KB.add_text_button(text="Пройти тест", payload={"test": "-1"}, color=ButtonColor.POSITIVE) MENU_KB.add_text_button(text="Пройти тест", payload={"test": "-1"}, color=ButtonColor.POSITIVE)
MENU_KB.add_link_button(text="Чат абитуриентов", link="https://vk.me/join/AJQ1dw97/SBEQYIyQdZfG69y") MENU_KB.add_link_button(text="Чат абитуриентов", link="https://vk.me/join/AJQ1dw97/SBEQYIyQdZfG69y")
MENU_KB.add_row() MENU_KB.add_row()
MENU_KB.add_text_button(text="Пообщаться со студентом", payload={"student": "1"}, color=ButtonColor.PRIMARY) MENU_KB.add_text_button(text="Пообщаться со студентом", payload={"student": "1"}, color=ButtonColor.PRIMARY)
MENU_KB.add_row() MENU_KB.add_row()
MENU_KB.add_text_button(text="Пообщаться преподавателем", payload={"teacher": "1"}, color=ButtonColor.PRIMARY) MENU_KB.add_text_button(text="Пообщаться с преподавателем", payload={"teacher": "1"}, color=ButtonColor.PRIMARY)
# MENU_KB.add_row() # MENU_KB.add_row()
# MENU_KB.add_text_button(text="АЧе делать?", payload={"man": "1"}, color=ButtonColor.PRIMARY) # MENU_KB.add_text_button(text="АЧе делать?", payload={"man": "1"}, color=ButtonColor.PRIMARY)
@ -78,9 +76,10 @@ WHAT_ENGINEER_ARE_YOU = "Кто ты из инженеров?"
WHAT_ENGINEER_ARE_YOU_KB = Keyboard() WHAT_ENGINEER_ARE_YOU_KB = Keyboard()
WHAT_ENGINEER_ARE_YOU_KB.add_text_button(text="Илон Маск", payload={"q": "Илон Маск"}, color=ButtonColor.PRIMARY) WHAT_ENGINEER_ARE_YOU_KB.add_text_button(text="Илон Маск", payload={"q": "Илон Маск"}, color=ButtonColor.PRIMARY)
WHAT_ENGINEER_ARE_YOU_KB.add_text_button(text="Дмитрий Рогозин", payload={"q": "Дмитрий Рогозин"}, color=ButtonColor.PRIMARY) WHAT_ENGINEER_ARE_YOU_KB.add_text_button(text="Дмитрий Рогозин", payload={"q": "Дмитрий Рогозин"}, color=ButtonColor.PRIMARY)
WHAT_ENGINEER_ARE_YOU_KB.add_text_button(text="Никола Тесла", payload={"q": "Никола Тесла"}, color=ButtonColor.PRIMARY)
WHAT_ENGINEER_ARE_YOU_KB.add_row() WHAT_ENGINEER_ARE_YOU_KB.add_row()
WHAT_ENGINEER_ARE_YOU_KB.add_text_button(text="Никола Тесла", payload={"q": "Никола Тесла"}, color=ButtonColor.PRIMARY)
WHAT_ENGINEER_ARE_YOU_KB.add_text_button(text="Иван Кулибин", payload={"q": "Иван Кулибин"}, color=ButtonColor.PRIMARY) WHAT_ENGINEER_ARE_YOU_KB.add_text_button(text="Иван Кулибин", payload={"q": "Иван Кулибин"}, color=ButtonColor.PRIMARY)
WHAT_ENGINEER_ARE_YOU_KB.add_row()
WHAT_ENGINEER_ARE_YOU_KB.add_text_button(text="Михаил Калашников", payload={"q": "Михаил Калашников"}, color=ButtonColor.PRIMARY) WHAT_ENGINEER_ARE_YOU_KB.add_text_button(text="Михаил Калашников", payload={"q": "Михаил Калашников"}, color=ButtonColor.PRIMARY)
WHAT_ENGINEER_ARE_YOU_KB.add_text_button(text="Юрий Кондратюк", payload={"q": "Юрий Кондратюк"}, color=ButtonColor.PRIMARY) WHAT_ENGINEER_ARE_YOU_KB.add_text_button(text="Юрий Кондратюк", payload={"q": "Юрий Кондратюк"}, color=ButtonColor.PRIMARY)
@ -103,9 +102,11 @@ FAV_THEME = "Какая школьная дисциплина нравится
FAV_THEME_KB = Keyboard() FAV_THEME_KB = Keyboard()
FAV_THEME_KB.add_text_button(text="Математика", payload={"q": "Математика"}, color=ButtonColor.PRIMARY) FAV_THEME_KB.add_text_button(text="Математика", payload={"q": "Математика"}, color=ButtonColor.PRIMARY)
FAV_THEME_KB.add_text_button(text="Русский/Литература", payload={"q": "русскийлитра"}, color=ButtonColor.PRIMARY) FAV_THEME_KB.add_text_button(text="Русский/Литература", payload={"q": "русскийлитра"}, color=ButtonColor.PRIMARY)
FAV_THEME_KB.add_text_button(text="Информатика/программирование", payload={"q": "Инфа"}, color=ButtonColor.PRIMARY)
FAV_THEME_KB.add_row() FAV_THEME_KB.add_row()
FAV_THEME_KB.add_text_button(text="Информатика/программирование", payload={"q": "Инфа"}, color=ButtonColor.PRIMARY)
FAV_THEME_KB.add_text_button(text="Физика", payload={"q": "Физика"}, color=ButtonColor.PRIMARY) FAV_THEME_KB.add_text_button(text="Физика", payload={"q": "Физика"}, color=ButtonColor.PRIMARY)
FAV_THEME_KB.add_row()
FAV_THEME_KB.add_text_button(text="История/обществознание", payload={"q": "Инфа"}, color=ButtonColor.PRIMARY)
FAV_THEME_KB.add_text_button(text="Другой", payload={"q": "other"}, color=ButtonColor.PRIMARY) FAV_THEME_KB.add_text_button(text="Другой", payload={"q": "other"}, color=ButtonColor.PRIMARY)
# 4 # 4
@ -128,11 +129,11 @@ TRANS_ENGINEER_COUNT_KB.add_text_button(text="5", payload={"q": "5"}, color=Butt
# 6 # 6
ZODIAC = "Кто вы по знаку зодиака?" ZODIAC = "Кто вы по знаку зодиака?"
# ZODIAC_KB = Keyboard() # ZODIAC_KB = Keyboard()
# 7 # # 7
CONTACT = "Введите почту или ник в телеграмме, по которому мы сможем прислать вам результаты" # CONTACT = "Введите почту или ник в телеграмме, по которому мы сможем прислать вам результаты"
# last # last
LAST_MESSAGE = "Спасибо, что прошли тест!" LAST_MESSAGE = "Теперь у вас есть ваш персональный NFT-талисман! Он поможет вам при сдаче экзаменов и поступлении в желаемый университет &#127775;"
LAST_MESSAGE_KB = Keyboard() LAST_MESSAGE_KB = Keyboard()
LAST_MESSAGE_KB.add_text_button(text="Вернуться на главную", payload={}, color=ButtonColor.POSITIVE) LAST_MESSAGE_KB.add_text_button(text="Вернуться на главную", payload={}, color=ButtonColor.POSITIVE)
@ -143,5 +144,5 @@ questions = [
(EGE, EGE_KB), (EGE, EGE_KB),
(TRANS_ENGINEER_COUNT, TRANS_ENGINEER_COUNT_KB), (TRANS_ENGINEER_COUNT, TRANS_ENGINEER_COUNT_KB),
(ZODIAC, None), (ZODIAC, None),
(CONTACT, None), # (CONTACT, None),
] ]

View File

@ -1,34 +1,14 @@
import io import io
import random import random
import os
from PIL import Image from PIL import Image
from flask import Flask, request, jsonify from flask import Flask, request, jsonify
import matplotlib.image as mpimg import matplotlib.image as mpimg
import numpy as np
import numba
import pickle
import base64 import base64
app = Flask(__name__) app = Flask(__name__)
IMAGE_PATH = 'pics'
@numba.njit
def optimized_mandelbrot(n_rows, n_columns, iterations, cx, cy):
x_cor = np.linspace(-2, 2, n_rows)
y_cor = np.linspace(-2, 2, n_columns)
output = np.zeros((n_rows,n_columns))
c = cx + 1j * cy
for i in range(n_rows):
for j in range(n_columns):
z = x_cor[i] + y_cor[j] * 1j
count = 0
for k in range(iterations):
z = (z*z) + c
count += 1
if np.abs(z) > 4:
break
output[i, j] = count
return output.T
def open_image_as_array(path): def open_image_as_array(path):
@ -40,19 +20,19 @@ def get_encoded_img(arr):
img_byte_arr = io.BytesIO() img_byte_arr = io.BytesIO()
img.save(img_byte_arr, format='PNG') img.save(img_byte_arr, format='PNG')
encoded_img = base64.encodebytes(img_byte_arr.getvalue()).decode('ascii') encoded_img = base64.encodebytes(img_byte_arr.getvalue()).decode('ascii')
return encoded_img return str(encoded_img)
@app.route('/getImage', methods=['GET']) @app.route('/getImage', methods=['GET'])
def get_image(): def get_image():
with open('data_100.pickle', 'rb') as f: # print(random.choice(os.listdir(IMAGE_PATH)))
images = pickle.load(f) image = mpimg.imread(os.path.join(IMAGE_PATH, random.choice(os.listdir(IMAGE_PATH))))
buffered = io.BytesIO() # buffered = io.BytesIO()
random.choice(images).save(buffered, format="JPEG") # image.save(buffered, format="JPEG")
img_str = base64.b64encode(buffered.getvalue()) # img_str = base64.b64encode(buffered.getvalue())
return jsonify({ return jsonify({
"code": 0, "code": 0,
"image": str(img_str.decode('ascii')), "image": get_encoded_img(image),
"first_time": 1 "first_time": 1
}) })

Binary file not shown.

BIN
nft_svc/pics/pic_0.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_1.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_10.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_100.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_101.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_102.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_103.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_104.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_105.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_106.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_107.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_108.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_109.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_11.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_110.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_111.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_112.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_113.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_114.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_115.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_116.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_117.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_118.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_119.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_12.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_120.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_121.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_122.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_123.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_124.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_125.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_126.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_127.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_128.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_129.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_13.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_130.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_131.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_132.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_133.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_134.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_135.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_136.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_137.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_138.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_139.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_14.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_140.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_141.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_142.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_143.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_144.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_145.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_146.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_147.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_148.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_149.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_15.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_150.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_151.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_152.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_153.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_154.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_155.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_156.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_157.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_158.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_159.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_16.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_160.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_161.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_162.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_163.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_164.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_165.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_166.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_167.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_168.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_169.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_17.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_170.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_171.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_172.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_173.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_174.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_175.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_176.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_177.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_178.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_179.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_18.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_180.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_181.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
nft_svc/pics/pic_182.jpg (Stored with Git LFS) Normal file

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More