add diff images

This commit is contained in:
if 2023-03-24 01:48:33 +03:00
parent 069b31ed93
commit 7744fb96be
4 changed files with 17 additions and 2 deletions

BIN
assets/ai_face.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

BIN
assets/ai_face2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 MiB

View File

@ -4,6 +4,7 @@ from pathlib import Path
from src.styles.menu_styles import HEADER_STYLES, FOOTER_STYLES
from src.utils.lang import en, ru
from src.utils.footer import show_donates, show_info
from src.utils.helpers import get_random_img, get_files_in_dir
from src.utils.conversation import get_user_input, show_chat_buttons, show_conversation
import streamlit as st
@ -13,7 +14,6 @@ current_dir = Path(__file__).parent if "__file__" in locals() else Path.cwd()
css_file = current_dir / "src/styles/.css"
assets_dir = current_dir / "assets"
icons_dir = assets_dir / "icons"
tg_svg = icons_dir / "telegram.svg"
tg_svg = icons_dir / "tg.svg"
# --- GENERAL SETTINGS ---
@ -78,7 +78,7 @@ if __name__ == "__main__":
st.markdown("---")
main()
st.markdown("---")
st.image("assets/ai.jpg")
st.image(f"assets/{get_random_img(get_files_in_dir(assets_dir))}")
st.markdown("---")
selected_footer = option_menu(
menu_title=None,

View File

@ -1,5 +1,8 @@
import base64
import os
import random
from pathlib import Path
from typing import List
def render_svg(svg: Path) -> str:
@ -7,3 +10,15 @@ def render_svg(svg: Path) -> str:
with open(svg) as file:
b64 = base64.b64encode(file.read().encode("utf-8")).decode("utf-8")
return f"<img src='data:image/svg+xml;base64,{b64}'/>"
def get_files_in_dir(path: Path) -> List[str]:
files = []
for file in os.listdir(path):
if os.path.isfile(os.path.join(path, file)):
files.append(file)
return files
def get_random_img(my_list: list) -> str:
return random.choice(my_list)