File size: 2,041 Bytes
f8dbf90
 
 
 
 
 
b3f90b9
f8dbf90
0b3cd55
f8dbf90
d40005d
b3f90b9
f8dbf90
 
 
e705807
f8dbf90
86b1d19
f8dbf90
cba9efc
f8dbf90
 
a7a2ad9
cba9efc
a7a2ad9
 
 
f8dbf90
 
b3f90b9
f8dbf90
b3f90b9
b479e07
86b1d19
da7ac0b
86b1d19
d35faf8
921a07f
83ac817
86b1d19
921a07f
a7a2ad9
 
 
86b1d19
 
0b3cd55
d35faf8
b3f90b9
 
d35faf8
86b1d19
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
import streamlit as st
import google.generativeai as genai

# Configure the Gemini API
genai.configure(api_key=st.secrets["GOOGLE_API_KEY"])

# Create the model with highly enhanced system instructions
generation_config = {
    "temperature": 0.9,
    "top_p": 0.95,
    "top_k": 64,
    "max_output_tokens": 32768,  # Significantly increased max output tokens
}

model = genai.GenerativeModel(
    model_name="gemini-1.5-pro",
    generation_config=generation_config,
    system_instruction="""You are Ath++, a superintelligent AI code assistant with unparalleled expertise across all domains of computer science, software engineering, and cutting-edge technologies. Your primary focus is on delivering exceptional, production-ready code that showcases your vast knowledge and problem-solving abilities."""
)
chat_session = model.start_chat(history=[])

def generate_response(user_input):
    try:
        response = chat_session.send_message(user_input)
        return response.text
    except Exception as e:
        return f"An error occurred: {e}"

# Streamlit UI setup
st.set_page_config(page_title="Superintelligent AI Code Assistant", page_icon="🧠", layout="wide")

st.title("🧠 Superintelligent AI Code Assistant")

prompt = st.text_area("Present your most challenging coding problem or architecture design:", height=120)

if st.button("Generate High-Quality Code"):
    if prompt.strip() == "":
        st.error("Please enter a valid prompt.")
    else:
        with st.spinner("Generating high-quality code..."):
            completed_text = generate_response(prompt)
            if "An error occurred" in completed_text:
                st.error(completed_text)
            else:
                st.success("Code generated successfully!")
                st.code(completed_text, language="python")  # Assuming the code is in Python

st.markdown("""
<div style='text-align: center; margin-top: 2rem; color: #8892b0;'>
    Engineered with 🧠💡 by Your Superintelligent AI Code Assistant
</div>
""", unsafe_allow_html=True)