File size: 1,016 Bytes
bddaf2f
 
 
 
 
 
87467e6
bddaf2f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import streamlit as st
from groq import Groq

st.set_page_config(page_title="Q-Audit – Qubic Smart Contract Auditor", page_icon="🛡️")
st.title("🛡️ Q-Audit – C++ Smart Contract Auditor for Qubic")

client = Groq(api_key="")

user_code = st.text_area("Paste your Qubic C++ Smart Contract Code:")

if st.button("🔍 Run AI Audit"):
    if user_code.strip() == "":
        st.warning("Please paste some code first.")
    else:
        with st.spinner("Analyzing with Groq AI..."):
            prompt = f"Audit this C++ smart contract for bugs, risks, or improvements:\n\n{user_code}"
            completion = client.chat.completions.create(
                model="llama3-70b-8192",
                messages=[{"role": "user", "content": prompt}],
                temperature=0.5,
            )
            st.subheader("🧠 AI Feedback:")
            st.write(completion.choices[0].message.content)

if st.button("📝 Save to Qubic"):
    st.success("✅ (Mock) Code submitted to Qubic smart contract.")