File size: 2,307 Bytes
066505e
ec0716b
ffb99d3
ec0716b
3b445f4
bb7b215
ffb99d3
bb7b215
ffb99d3
bb7b215
 
8605bb8
bb7b215
 
 
5581d66
bb7b215
 
9260a76
5581d66
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79d880e
ffb99d3
5581d66
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c8c0952
 
4f8a663
5c43d8c
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
85
86
87
88
89
90
91
92
93
94
95
96
import streamlit as st
from groq import Groq

# Define the API key here
GROQ_API_KEY = "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"

# Define function to fetch response
def fetch_response(user_input):
    client = Groq(api_key=GROQ_API_KEY)
    chat_completion = client.chat.completions.create(
        messages=[
            {"role": "system", "content": "you are a helpful assistant. Take the input from the users and try to provide as detailed response as possible. Provide proper expamples to help the user. Try to mention references or provide citations to make it more detail oriented."},
            {"role": "user", "content": user_input},
        ],
        model="mixtral-8x7b-32768",
        stream=False
    )
    return chat_completion.choices[0].message.content

# Set page config
st.set_page_config(
    page_title="CyberChat",
    page_icon="🤖",
    layout="wide",
    initial_sidebar_state="expanded"
)

# Cyberpunk style CSS
cyberpunk_style = """
<style>
body {
    color: #8AFF80;
    background-color: #0D0D0D;
}

.stButton>button {
    color: #8AFF80 !important;
    background-color: #0D0D0D !important;
    border-color: #8AFF80 !important;
    font-family: 'Orbitron', sans-serif;
    border-radius: 20px;
}

.stTextInput>div>div>input {
    color: #8AFF80 !important;
    background-color: #0D0D0D !important;
    border-color: #8AFF80 !important;
    font-family: 'Orbitron', sans-serif;
}

.stTextInput>div>div>input::placeholder {
    color: #8AFF80 !important;
}

.stTextInput>div>div>input:focus {
    border-color: #8AFF80 !important;
    box-shadow: 0 0 0 0.2rem rgba(138, 255, 163, 0.5) !important;
}

footer {
    color: #8AFF80;
    font-size: small;
    text-align: right;
    font-family: 'Orbitron', sans-serif;
}
</style>
"""

# Streamlit app
st.markdown(cyberpunk_style, unsafe_allow_html=True)
st.title("CyberChat")
st.subheader("Ask a question and get a response.")

# Text input for user's question
user_input = st.text_input("Enter your question here:")

# Button to trigger response
if st.button("Get Response"):
    # Fetch and display response
    response = fetch_response(user_input)
    st.write("Response:", response)

# Footer
st.markdown(
    """
    <footer>
        By DL Titans
    </footer>
    """,
    unsafe_allow_html=True
)