MrSiebel585 commited on
Commit
c98f89b
·
1 Parent(s): b90b4c2

Switch to Streamlit UI and add multipage layout

Browse files
Files changed (4) hide show
  1. app.py +9 -21
  2. pages/Example.py +4 -0
  3. pages/Omnieye.py +15 -1
  4. pages/Omnilog.py +23 -1
app.py CHANGED
@@ -3,26 +3,14 @@ import streamlit as st
3
  st.set_page_config(page_title="Omniscient Dashboard", layout="wide")
4
 
5
  st.title("🤖 Omniscient LLM Dashboard")
6
- st.write("This Hugging Face Space runs **Streamlit** as the default UI.")
7
 
8
- page = st.sidebar.radio("📑 Pages", ["Chat", "System Health"])
 
9
 
10
- if "messages" not in st.session_state:
11
- st.session_state.messages = []
12
-
13
- if page == "Chat":
14
- st.subheader("Chat Interface")
15
- for m in st.session_state.messages:
16
- st.chat_message(m["role"]).write(m["content"])
17
-
18
- if prompt := st.chat_input("Ask me anything..."):
19
- st.session_state.messages.append({"role": "user", "content": prompt})
20
- with st.chat_message("assistant"):
21
- reply = f"Echo: {prompt} (LLM hook goes here)"
22
- st.write(reply)
23
- st.session_state.messages.append({"role": "assistant", "content": reply})
24
-
25
- elif page == "System Health":
26
- st.subheader("System Health")
27
- st.metric("Active Sessions", len(st.session_state.get("messages", [])))
28
- st.success("Backend API is running on /health (FastAPI)")
 
3
  st.set_page_config(page_title="Omniscient Dashboard", layout="wide")
4
 
5
  st.title("🤖 Omniscient LLM Dashboard")
6
+ st.write("Welcome! This Space is running **Streamlit multipage mode**.")
7
 
8
+ st.metric("Active Sessions", len(st.session_state.get("messages", [])))
9
+ st.success("System ready ✅")
10
 
11
+ st.markdown("""
12
+ Use the sidebar to access:
13
+ - 👁️ Omnieye → keyword/file analysis
14
+ - 📜 Omnilog → log parsing & summaries
15
+ - 🧪 Example → placeholder module
16
+ """)
 
 
 
 
 
 
 
 
 
 
 
 
 
pages/Example.py ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ import streamlit as st
2
+
3
+ st.title("🧪 Example Page")
4
+ st.write("Drop any `.py` file into `/pages/` and it appears in the sidebar automatically.")
pages/Omnieye.py CHANGED
@@ -1,4 +1,18 @@
1
  import streamlit as st
 
2
 
3
  st.title("👁️ Omnieye")
4
- st.write("This is a placeholder for the Omnieye module.")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import streamlit as st
2
+ import re
3
 
4
  st.title("👁️ Omnieye")
5
+ st.write("Keyword/file analyzer module")
6
+
7
+ uploaded = st.file_uploader("Upload a text/log file", type=["txt", "log"])
8
+ if uploaded:
9
+ content = uploaded.read().decode("utf-8", errors="ignore")
10
+
11
+ query = st.text_input("🔍 Search for keyword")
12
+ if query:
13
+ matches = [line for line in content.splitlines() if re.search(query, line, re.IGNORECASE)]
14
+ st.write(f"Found {len(matches)} matches")
15
+ st.code("\n".join(matches[:50]))
16
+
17
+ st.subheader("📋 File Preview")
18
+ st.code("\n".join(content.splitlines()[:30]))
pages/Omnilog.py CHANGED
@@ -1,4 +1,26 @@
1
  import streamlit as st
 
2
 
3
  st.title("📜 Omnilog")
4
- st.write("This is a placeholder for the Omnilog module.")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import streamlit as st
2
+ import re, hashlib
3
 
4
  st.title("📜 Omnilog")
5
+ st.write("Log analyzer module")
6
+
7
+ uploaded = st.file_uploader("Upload a log file", type=["log", "txt"])
8
+ if uploaded:
9
+ content = uploaded.read().decode("utf-8", errors="ignore")
10
+
11
+ noise = re.compile(r"^\w{3}\s+\d+\s+\d{2}:\d{2}:\d{2}\s+[\w\-\.\:]+\s+")
12
+ normalized = [noise.sub("", line) for line in content.splitlines()]
13
+
14
+ st.subheader("🧹 Normalized Logs")
15
+ st.code("\n".join(normalized[:50]))
16
+
17
+ st.subheader("📊 Stats")
18
+ st.metric("Total Lines", len(normalized))
19
+ st.metric("Unique Entries", len(set(normalized)))
20
+ st.write("SHA1 Digest:", hashlib.sha1(content.encode()).hexdigest())
21
+
22
+ query = st.text_input("🔍 Search logs")
23
+ if query:
24
+ matches = [line for line in normalized if query.lower() in line.lower()]
25
+ st.success(f"Found {len(matches)} matches")
26
+ st.code("\n".join(matches[:50]))