| import streamlit as st |
| import google.generativeai as genai |
|
|
| |
| genai.configure(api_key=st.secrets["GOOGLE_API_KEY"]) |
|
|
| |
| generation_config = { |
| "temperature": 0.9, |
| "top_p": 0.95, |
| "top_k": 64, |
| "max_output_tokens": 32768, |
| } |
|
|
| 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 without any explanations or additional text.""" |
| ) |
| 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}" |
|
|
| |
| 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") |
|
|
| 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) |