Compare commits

37 Commits

Author SHA1 Message Date
gav
1bfaa94005 Update '.drone.yml'
All checks were successful
continuous-integration/drone/push Build is passing
2022-09-12 15:51:41 +07:00
gav
1274909088 Update '.drone.yml'
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
2022-09-12 14:41:25 +07:00
gav
bd3b859add Update '.drone.yml'
Some checks reported errors
continuous-integration/drone/push Build was killed
2022-09-12 14:37:10 +07:00
gav
6fa27c175f Update '.drone.yml'
Some checks failed
continuous-integration/drone/push Build is failing
2022-09-12 14:19:18 +07:00
gav
530c9c96fd Update '.drone.yml'
Some checks failed
continuous-integration/drone/push Build is failing
2022-09-12 13:25:04 +07:00
gav
0c3ac88812 Update '.drone.yml' 2022-05-08 13:50:42 +07:00
gav
ad9dce9a89 Update '.drone.yml'
Some checks failed
continuous-integration/drone/push Build is failing
2022-05-08 13:49:28 +07:00
gav
65531336ad Update '.drone.yml'
All checks were successful
continuous-integration/drone/push Build is passing
2022-05-08 13:39:26 +07:00
gav
169e9c36a9 Update '.drone.yml'
All checks were successful
continuous-integration/drone/push Build is passing
2022-05-08 13:37:54 +07:00
gav
9d8d1d0fdd Update '.drone.yml'
Some checks failed
continuous-integration/drone/push Build is failing
2022-05-08 13:33:43 +07:00
gav
bd82a7c1a7 Update '.drone.yml'
Some checks failed
continuous-integration/drone/push Build is failing
2022-05-08 13:33:12 +07:00
gav
fc50d21ab2 Update '.drone.yml'
Some checks failed
continuous-integration/drone/push Build is failing
2022-05-08 13:32:03 +07:00
gav
ce4c89aa8d Update '.drone.yml'
Some checks failed
continuous-integration/drone/push Build is failing
2022-05-08 13:29:20 +07:00
gav
b6b6d0e6aa Update '.drone.yml' 2022-05-08 13:28:04 +07:00
gav
bf36286307 Update '.drone.yml'
Some checks reported errors
continuous-integration/drone/push Build was killed
2022-05-08 13:22:48 +07:00
gav
7113f914c5 Update '.drone.yml'
Some checks reported errors
continuous-integration/drone/push Build was killed
2022-05-08 13:14:03 +07:00
gav
b686d39818 Update '.drone.yml'
Some checks reported errors
continuous-integration/drone/push Build was killed
2022-05-08 13:13:46 +07:00
gav
166b2bd8ef Update '.drone.yml' 2022-05-08 13:13:25 +07:00
gav
f9217fd736 Update '.drone.yml'
Some checks reported errors
continuous-integration/drone/push Build was killed
2022-05-08 13:11:32 +07:00
gav
26ac8ddc90 Update '.drone.yml'
Some checks failed
continuous-integration/drone/push Build is failing
2022-05-08 13:05:29 +07:00
gav
2c18fec1f6 Update '.drone.yml'
Some checks failed
continuous-integration/drone/push Build is failing
2022-05-08 13:02:32 +07:00
gav
08fc8f56e7 Update '.drone.yml' 2022-05-08 13:01:39 +07:00
gav
f26f7cce37 Update '.drone.yml'
Some checks failed
continuous-integration/drone/push Build is failing
2022-05-08 02:36:30 +07:00
b313b15686 Test fix nft_svc
Some checks failed
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is failing
2022-05-08 01:11:56 +07:00
aacb413176 Some fix
All checks were successful
continuous-integration/drone/push Build is passing
2022-05-08 01:06:05 +07:00
efc711cd3b Added jpeg to png converted images
All checks were successful
continuous-integration/drone/push Build is passing
2022-05-08 01:02:04 +07:00
b77f1bc13d Remove jpeg's
All checks were successful
continuous-integration/drone/push Build is passing
2022-05-08 00:49:08 +07:00
55f17606d6 Merge branch 'main' of https://gitea.gavt45.ru/gav/es-bot
All checks were successful
continuous-integration/drone/push Build is passing
2022-05-08 00:44:41 +07:00
e0c9aad35a Update pictures 2022-05-08 00:44:19 +07:00
gav
8c558f7bc0 Merge pull request 'Job of fucking copywriter!!!' (#4) from text-edition into main
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #4
Reviewed-by: gav <a@a.aa>
2022-05-05 12:13:54 +07:00
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
96 changed files with 342 additions and 39 deletions

View File

@ -1,10 +1,59 @@
# ---
# kind: pipeline
# type: docker
# name: deploy-to-docker-vm
# clone:
# disable: true
# steps:
# - name: greeting
# image: appleboy/drone-ssh
# settings:
# host:
# from_secret: docker_host
# username:
# from_secret: docker_user
# key:
# from_secret: docker_privkey
# port: 2200
# script:
# - whoami
# - uname -a
# - mkdir -p deploy; cd deploy
# - git clone https://gitea.gavt45.ru/gav/es-bot.git
# - cd es-bot
# - git checkout main
# - docker-compose build
# when:
# branch:
# - main
# ---
# kind: pipeline
# type: docker
# name: test-secrets-pipeline
# steps:
# - name: test-secrets
# image: alpine
# environment:
# HOST:
# from_secret: docker_host
# commands:
# - env
kind: pipeline kind: pipeline
type: docker type: docker
name: default name: default
steps: steps:
- name: greeting - name: docker
image: alpine image: plugins/docker
commands: settings:
- echo hello auto_tag: true
- echo world auto_tag_suffix: kek
registry: registry.gavt45.ru
username:
from_secret: docker_username
password:
from_secret: docker_password
repo: registry.gavt45.ru/es-bot

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

@ -4,8 +4,8 @@ from vkwave.bots import Keyboard, ButtonColor
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")
@ -102,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
@ -131,7 +133,7 @@ ZODIAC = "Кто вы по знаку зодиака?"
# CONTACT = "Введите почту или ник в телеграмме, по которому мы сможем прислать вам результаты" # CONTACT = "Введите почту или ник в телеграмме, по которому мы сможем прислать вам результаты"
# last # last
LAST_MESSAGE = "Теперь у вас есть ваш персональный NFT-талисман! Он поможет вам при сдаче экзаменов и поступлении в желаемый ВУЗ &#127775;" 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)

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):
@ -36,23 +16,24 @@ def open_image_as_array(path):
def get_encoded_img(arr): def get_encoded_img(arr):
img = Image.fromarray(arr).convert("L") img = Image.fromarray(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) file = 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())
image = base64.encodebytes(open(file, 'rb').read()).decode('ascii')
return jsonify({ return jsonify({
"code": 0, "code": 0,
"image": str(img_str.decode('ascii')), "image": image,
"first_time": 1 "first_time": 1
}) })

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.