File size: 2,253 Bytes
be80291
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e18f81d
be80291
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
bc078cc
be80291
35e9c22
be80291
f6540d5
bcc2308
be80291
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import os
import time
import base64
import streamlit as st


st.set_page_config(page_title='StoicCyber', page_icon="🏛️", layout="centered", initial_sidebar_state="collapsed")

# show background image
def get_base64_of_bin_file2(bin_file):
    with open(bin_file, 'rb') as f:
        data = f.read()
    return base64.b64encode(data).decode()

def set_png_as_page_bg(png_file):
    bin_str = get_base64_of_bin_file2(png_file) 
    page_bg_img = '''
    <link href='https://fonts.googleapis.com/css?family=Libre Baskerville' rel='stylesheet'>
    <style>
    .stApp {
    background-image: url("data:image/png;base64,%s");
    background-size: cover;
    background-repeat: no-repeat;
    background-attachment: scroll; 
    }
    </style>
    ''' % bin_str
    st.markdown(page_bg_img, unsafe_allow_html=True)
    return

set_png_as_page_bg('pxfuel.jpg')

# header
original_title = '<h1 style="font-family: Libre Baskerville; color:#faf8f8; font-size: 30px; text-align: left; ">STOIC Ω CYBER</h1>'
st.markdown(original_title, unsafe_allow_html=True)

@st.cache_resource
def load_model():
    # return load()
    pass


    
# chat componenets

def get_response(user_question):
    progress_text = "Loading model. Please wait."
    my_bar = st.progress(0, text=progress_text)
    # run the functions in the place of time sleep
    time. sleep(1) 
    my_bar.progress(0.3, "Loading Model.  Please wait.")
    time. sleep(5) 
    my_bar.progress(0.6, "Generating Answer.  Please wait.")
    time. sleep(5) 
    my_bar.progress(0.9, "Post Processing.  Please wait.")
    time. sleep(5) 
    my_bar.progress(1.0, "Done")
    time. sleep(1) 
    my_bar.empty()
    return "I don't know!"


user_question = st.chat_input('What do you want to ask ..')

if user_question is not None and user_question!="":
    with st.chat_message("Human", avatar="🧔🏻"):
        st.write(user_question)
    response = get_response(user_question)   
    with st.chat_message("AI", avatar="🏛️"):
        st.write(response)


# Hide footer and header  
hide_st_style = """
            <style>
            header {visibility: hidden;}
            footer {visibility: hidden;}
            </style>
            """
st.markdown(hide_st_style, unsafe_allow_html=True)