personal-ai / app.py
manishksharma98's picture
Viona: HF Space — InferenceClient, Dockerfile PORT, README metadata
66a7f89 verified
"""CyberWatch Streamlit web UI — Viona chat and security tooling entry."""
from __future__ import annotations
import logging
import os
import streamlit as st
from dotenv import load_dotenv
from ai.llm import inference_backend_label, viona_complete
load_dotenv()
logging.basicConfig(level=os.getenv("LOG_LEVEL", "INFO"))
APP_NAME = os.getenv("APP_NAME", "CyberWatch")
THEME_CSS = """
@import url('https://fonts.googleapis.com/css2?family=Exo+2:wght@400;600&family=Share+Tech+Mono&display=swap');
html, body, [class*="css"] { font-family: 'Exo 2', sans-serif; }
h1, h2, h3 { font-family: 'Share Tech Mono', monospace; color: #4fc3f7 !important; }
section.main > div { background-color: #0a0e1a; color: #e8eaf0; }
.metric-container { background: #121826; border: 1px solid #1e2740; border-radius: 8px; padding: 0.5rem; }
"""
def main() -> None:
st.set_page_config(page_title=f"{APP_NAME} | Viona", layout="wide")
st.markdown(f"<style>{THEME_CSS}</style>", unsafe_allow_html=True)
if "disclaimer_ok" not in st.session_state:
st.session_state.disclaimer_ok = False
if not st.session_state.disclaimer_ok:
st.title(APP_NAME)
st.error(
"**Authorized use only.** CyberWatch and Viona are for research and "
"defensive security on systems and networks you own or have **explicit written "
"permission** to test. Misuse may be illegal."
)
if st.button("I understand — continue"):
st.session_state.disclaimer_ok = True
st.rerun()
st.stop()
st.title(f"{APP_NAME} / Viona")
st.caption("Cybersecurity research assistant")
c1, c2, c3 = st.columns(3)
with c1:
st.metric("Assistant", "Viona")
with c2:
st.metric("Inference", inference_backend_label().upper())
with c3:
st.metric("Log level", os.getenv("LOG_LEVEL", "INFO"))
if "messages" not in st.session_state:
st.session_state.messages = []
for m in st.session_state.messages:
with st.chat_message(m["role"], avatar="🛡️" if m["role"] == "assistant" else None):
label = "Viona" if m["role"] == "assistant" else "You"
st.caption(label)
st.markdown(m["content"])
prompt = st.chat_input("Message Viona…")
if prompt:
st.session_state.messages.append({"role": "user", "content": prompt})
reply = viona_complete(prompt)
st.session_state.messages.append({"role": "assistant", "content": reply})
st.rerun()
if __name__ == "__main__":
main()