add diff images
This commit is contained in:
parent
069b31ed93
commit
7744fb96be
BIN
assets/ai_face.png
Normal file
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
BIN
assets/ai_face2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.5 MiB |
4
chat.py
4
chat.py
@ -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,
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user