mm / vv.py
cdr4cdr's picture
Create vv.py
5da5f62 verified
Raw History Blame Contribute Delete
2.85 kB
import streamlit as st
from mistralai import Mistral
import os
# Configuração de Elite: Tema Preto e Interface Limpa
st.set_page_config(page_title="Focus PRF IAQstron", layout="centered")
st.markdown("""
<style>
.stApp { background-color: #000000; color: #ffffff; }
.card {
background: #111111;
padding: 25px;
border-radius: 12px;
border: 1px solid #333;
line-height: 1.8;
margin-bottom: 20px;
}
h2 { color: #00ff88; font-size: 1.2rem; border-bottom: 1px solid #222; padding-bottom: 10px; }
.verbo { color: #fff; background: #cc0000; padding: 2px 6px; border-radius: 4px; font-weight: bold; }
.sumula { color: #ffd700; font-weight: bold; text-decoration: underline; }
b { color: #00ff88; }
/* Esconder menus desnecessários */
#MainMenu {visibility: hidden;}
footer {visibility: hidden;}
header {visibility: hidden;}
</style>
""", unsafe_allow_html=True)
# Conexão Neural
api_key = os.getenv("MISTRAL_API_KEY")
client = Mistral(api_key=api_key)
st.markdown("<h1 style='text-align: center; color: #00ff88;'>FOCUS PRF IAQSTRON</h1>", unsafe_allow_html=True)
st.markdown("<p style='text-align: center; color: #888;'>Motor de Inteligência // Fatiamento 360°</p>", unsafe_allow_html=True)
query = st.text_input("", placeholder="Qual artigo ou tema vamos triturar?")
if query:
if not api_key:
st.error("Erro: Adicione a MISTRAL_API_KEY em Settings > Secrets.")
else:
with st.spinner("Fatiando base legal e caçando pegadinhas..."):
try:
prompt = f"""
Você é o motor principal do Focus PRF IAQstron.
Explique o tema '{query}' de forma fatiada e letal para a PRF.
REGRAS OBRIGATÓRIAS:
1. Foque em PEGADINHAS DE VERBOS que a Cebraspe usa.
2. Use HTML: <h2> para títulos e <p> para texto.
3. Verbos de comando devem estar em <span class='verbo'>VERBO</span>.
4. Súmulas em <span class='sumula'>Súmula X</span>.
5. PROIBIDO usar asteriscos (*), hashtags (#) ou hifens.
ESTRUTURA:
<h2>📜 LEI SECA FATIADA</h2>
<h2>⚖️ PUNIÇÃO ADM vs CRIMINAL</h2>
<h2>🏛️ JURISPRUDÊNCIA</h2>
<h2>📖 MALDADE DA BANCA (PEGADINHAS)</h2>
"""
resp = client.chat.complete(model="mistral-small-latest", messages=[{"role": "user", "content": prompt}])
answer = resp.choices[0].message.content.replace('*', '').replace('#', '')
st.markdown(f"<div class='card'>{answer}</div>", unsafe_allow_html=True)
except Exception as e:
st.error(f"Erro: {e}")