Onyxl commited on
Commit
1041fbb
·
verified ·
1 Parent(s): 817543c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +65 -73
app.py CHANGED
@@ -1,81 +1,73 @@
1
- import sys
2
-
3
- # --- ONYX PRE-FLIGHT: FIX FOR PYTHON 3.13 ---
4
- try:
5
- import audioop
6
- except ImportError:
7
- try:
8
- from audioop_lts import audioop
9
- sys.modules["audioop"] = audioop
10
- except ImportError:
11
- # If the library is missing, we create a 'Ghost' module to stop the crash
12
- from types import ModuleType
13
- sys.modules["audioop"] = ModuleType("audioop")
14
- # --------------------------------------------
15
-
16
- import gradio as gr
17
  import time
18
 
19
- # GLOBAL STORAGE: Managed within the 7GB RAM Fortress
20
- team_messages = []
21
-
22
- def get_user_data(request: gr.Request):
23
- if request and request.user_info:
24
- return request.user_info.preferred_username, request.user_info.picture
25
- return None, None
26
-
27
- def send_to_fleet(message, request: gr.Request):
28
- if not message: return ""
29
- username, avatar = get_user_data(request)
30
- if not username: return "⚠️ ACCESS DENIED: Please Login with HF first."
31
-
32
- team_messages.append({"user": username, "avatar": avatar, "text": message})
33
- if len(team_messages) > 50: team_messages.pop(0)
34
- return ""
35
-
36
- def sync_labyrinth():
37
- formatted = []
38
- for m in team_messages:
39
- formatted.append({
40
- "role": "user",
41
- "content": m["text"],
42
- "metadata": {"title": f" {m['user']}"}
43
- })
44
- return formatted
45
 
46
- # --- UI ARCHITECTURE (Onyx Color Rules) ---
47
- css = """
48
- .gradio-container { background-color: #050505 !important; color: #00FF00 !important; }
49
- .message-user { border-left: 3px solid #FFD700 !important; background: #0a0a0a !important; }
50
- #status-panel { border: 1px solid #333; padding: 15px; border-radius: 8px; }
51
- footer { visibility: hidden; }
52
- """
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
 
54
- with gr.Blocks(theme=gr.themes.Monochrome(), css=css) as demo:
55
- gr.HTML("<h1 style='color: #00FF00; text-align: center;'>🟢 TERABITES AI TEAM</h1>")
56
-
57
- with gr.Row():
58
- with gr.Column(scale=1, elem_id="status-panel"):
59
- gr.Markdown("### 🛡️ SYSTEM STATUS")
60
- gr.LoginButton(size="lg")
61
- gr.Label(value="VM: ACTIVE", color="green")
62
- gr.Label(value="RAM: 7GB STABLE", color="green")
63
- gr.Markdown("---")
64
- gr.Markdown("Welcome, Team. Use the **Gold-Bordered** stream for secure comms.")
65
 
66
- with gr.Column(scale=3):
67
- chat_stream = gr.Chatbot(
68
- label="TeraBites Global Feed",
69
- height=550,
70
- type="messages"
71
- )
72
- with gr.Row():
73
- txt_input = gr.Textbox(placeholder="Input command to the fleet...", show_label=False, scale=4)
74
- submit_btn = gr.Button("🚀 SEND", variant="primary", scale=1)
75
 
76
- demo.load(sync_labyrinth, None, chat_stream, every=2)
77
- txt_input.submit(send_to_fleet, [txt_input], [txt_input]).then(sync_labyrinth, None, chat_stream)
78
- submit_btn.click(send_to_fleet, [txt_input], [txt_input]).then(sync_labyrinth, None, chat_stream)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
 
80
  if __name__ == "__main__":
81
- demo.launch()
 
1
+ import streamlit as st
2
+ import streamlit.components.v1 as components
3
+ import random
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  import time
5
 
6
+ def terabites_system_core():
7
+ st.set_page_config(page_title="TeraBites Core", layout="centered")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
 
9
+ # 1. The TeraBites Rubix Oval (Pure Visuals)
10
+ # Using your cyan/white palette
11
+ oval_html = """
12
+ <div style="background: #000; padding: 30px; border-radius: 20px; text-align: center; border: 1px solid #333;">
13
+ <div id="oval" style="
14
+ width: 150px; height: 75px;
15
+ border: 3px solid #fff; border-radius: 50%;
16
+ margin: auto; display: flex; align-items: center; justify-content: center;
17
+ position: relative; box-shadow: 0 0 20px #00f2ff;">
18
+ <h2 style="color: #fff; font-family: 'Courier New'; margin: 0; letter-spacing: 2px;">TeraBites</h2>
19
+ <div class="wave"></div>
20
+ </div>
21
+ <style>
22
+ .wave {
23
+ position: absolute; width: 100%; height: 100%;
24
+ border: 2px solid #00f2ff; border-radius: 50%;
25
+ animation: ripple 2s infinite;
26
+ }
27
+ @keyframes ripple {
28
+ 0% { transform: scale(1); opacity: 1; }
29
+ 100% { transform: scale(2.5); opacity: 0; }
30
+ }
31
+ </style>
32
+ </div>
33
+ """
34
+ components.html(oval_html, height=180)
35
 
36
+ # 2. Control Logic
37
+ if 'sys_active' not in st.session_state:
38
+ st.session_state.sys_active = False
 
 
 
 
 
 
 
 
39
 
40
+ col1, col2 = st.columns(2)
41
+ with col1:
42
+ if st.button(" INITIALIZE"):
43
+ st.session_state.sys_active = True
44
+ with col2:
45
+ if st.button("■ STOP ALL"):
46
+ st.session_state.sys_active = False
47
+ st.rerun()
 
48
 
49
+ # 3. The Soundtrack & Data Feed
50
+ if st.session_state.sys_active:
51
+ # Plays the Megalovania Soundtrack
52
+ st.video("https://www.youtube.com/watch?v=KK3KXAECte4")
53
+
54
+ st.subheader("📡 SYSTEM DATA STREAM")
55
+ terminal = st.empty()
56
+
57
+ # Generates fake technical "chatter" instead of lyrics
58
+ for _ in range(20):
59
+ if not st.session_state.sys_active: break
60
+
61
+ bit_rate = random.randint(320, 999)
62
+ core_load = random.randint(70, 99)
63
+ freq = random.uniform(44.1, 48.0)
64
+
65
+ log_entry = f"FEED_ID: 0x{random.randint(1000, 9999)} | BITRATE: {bit_rate}kbps | LOAD: {core_load}% | FREQ: {freq:.1f}kHz"
66
+
67
+ terminal.code(f"RUNNING: {log_entry}", language="bash")
68
+ time.sleep(0.8) # Fast update to match the upbeat soundtrack
69
+ else:
70
+ st.info("Core Standby. Awaiting Signal...")
71
 
72
  if __name__ == "__main__":
73
+ terabites_system_core()