Update README.md
Browse files
README.md
CHANGED
|
@@ -1,10 +1,67 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
# --- THE HARD-CODED BLUEPRINT FOR GEMMA 3 ---
|
| 4 |
+
SYSTEM_CONTEXT = "TeraBites UI: Top-left Profile, Top-right Gemma Support, Middle Chat, Bottom Prompt."
|
| 5 |
+
|
| 6 |
+
def gemma_3_local_service(query):
|
| 7 |
+
# Simulated Gemma 3 Intelligence based on the fed code
|
| 8 |
+
if "group" in query.lower():
|
| 9 |
+
return "Gemma 3: Main Group is the foundation. Create squads in Settings."
|
| 10 |
+
return "Gemma 3: Standing by. No external connections active. Space is Secure."
|
| 11 |
+
|
| 12 |
+
def handle_chat(msg, history):
|
| 13 |
+
# Pure local chat logic
|
| 14 |
+
return history + [[msg, "๐ก [LOCAL SQUAD] Message received. (Isolated Mode)"]]
|
| 15 |
+
|
| 16 |
+
with gr.Blocks(theme=gr.themes.Monochrome(), css=".chat-feed {height: 60vh !important;}") as demo:
|
| 17 |
+
|
| 18 |
+
# 1. THE HEADER (Identity & Support)
|
| 19 |
+
with gr.Row():
|
| 20 |
+
with gr.Column(scale=1, variant="panel"):
|
| 21 |
+
gr.Markdown("๐ค **IDENTITY**")
|
| 22 |
+
profile_name = gr.Textbox(value="Loading...", interactive=True, show_label=False)
|
| 23 |
+
gr.Markdown("๐ **RANK:** WARRIOR")
|
| 24 |
+
|
| 25 |
+
with gr.Column(scale=2):
|
| 26 |
+
gr.Markdown("<h1 style='text-align: center;'>๐๏ธ TERABITESโข HQ</h1>")
|
| 27 |
+
gr.Markdown("<p style='text-align: center;'>STATUS: <b>OFFLINE / ISOLATED</b></p>")
|
| 28 |
+
|
| 29 |
+
with gr.Column(scale=1, variant="panel"):
|
| 30 |
+
gr.Markdown("๐ง **GEMMA 3 SERVICE**")
|
| 31 |
+
support_in = gr.Textbox(placeholder="Ask about the UI...", show_label=False)
|
| 32 |
+
support_out = gr.Markdown("*Ready*")
|
| 33 |
+
|
| 34 |
+
gr.Markdown("---")
|
| 35 |
+
|
| 36 |
+
# 2. THE BODY (Groups & Chat)
|
| 37 |
+
with gr.Row():
|
| 38 |
+
# Sidebar
|
| 39 |
+
with gr.Column(scale=1):
|
| 40 |
+
gr.Markdown("### ๐ฅ SQUADS")
|
| 41 |
+
group_sel = gr.Radio(["๐ MAIN (Public)", "๐ ๏ธ SQUAD-ALPHA"], value="๐ MAIN (Public)", label=None)
|
| 42 |
+
|
| 43 |
+
with gr.Accordion("โ๏ธ SETTINGS", open=False):
|
| 44 |
+
gr.Button("Invite Link (Testing)")
|
| 45 |
+
gr.Button("Delete Squad (Disabled)")
|
| 46 |
+
|
| 47 |
+
# The Big Gap (Chat)
|
| 48 |
+
with gr.Column(scale=4):
|
| 49 |
+
chatbot = gr.Chatbot(label=None, show_label=False, elem_classes="chat-feed")
|
| 50 |
+
|
| 51 |
+
# 3. THE PROMPT (Bottom Center)
|
| 52 |
+
with gr.Row():
|
| 53 |
+
msg_in = gr.Textbox(placeholder="Type a message...", scale=9, show_label=False)
|
| 54 |
+
send_btn = gr.Button("SUI", scale=1, variant="primary")
|
| 55 |
+
|
| 56 |
+
# --- LOCAL CONNECTIONS ONLY ---
|
| 57 |
+
support_in.submit(gemma_3_local_service, support_in, support_out)
|
| 58 |
+
send_btn.click(handle_chat, [msg_in, chatbot], [chatbot])
|
| 59 |
+
|
| 60 |
+
# HF Auth Profile Sync (Display only)
|
| 61 |
+
def sync_identity(profile: gr.OAuthProfile | None):
|
| 62 |
+
if profile: return profile.name
|
| 63 |
+
return "Guest_Warrior"
|
| 64 |
+
|
| 65 |
+
demo.load(sync_identity, None, profile_name)
|
| 66 |
+
|
| 67 |
+
demo.launch()
|