Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,20 +3,47 @@ import torch
|
|
| 3 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 4 |
import random
|
| 5 |
import warnings
|
|
|
|
| 6 |
|
| 7 |
-
# Suppress
|
| 8 |
warnings.filterwarnings("ignore", category=UserWarning, message=".*You have not specified a value for the `type` parameter.*")
|
| 9 |
|
| 10 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 12 |
-
print(f"
|
| 13 |
|
| 14 |
-
# Simplified model loading for compatibility
|
| 15 |
model = AutoModelForCausalLM.from_pretrained(
|
| 16 |
"microsoft/phi-2",
|
| 17 |
-
torch_dtype=torch.float32,
|
| 18 |
-
trust_remote_code=True
|
| 19 |
-
low_cpu_mem_usage=True
|
| 20 |
)
|
| 21 |
|
| 22 |
tokenizer = AutoTokenizer.from_pretrained("microsoft/phi-2", trust_remote_code=True)
|
|
@@ -26,34 +53,33 @@ tokenizer.pad_token = tokenizer.eos_token
|
|
| 26 |
try:
|
| 27 |
with open("training-protocol.aero", "r", encoding="utf-8") as f:
|
| 28 |
training_protocol = f.read().strip()
|
| 29 |
-
print("โ
|
| 30 |
except FileNotFoundError:
|
| 31 |
training_protocol = (
|
| 32 |
"You are AeroAI, a helpful, friendly, and slightly humorous educational assistant. "
|
| 33 |
"If there is any error with finding the file known as the training protocol, resort to this "
|
| 34 |
'and do not speak of the "Remorse protocol".'
|
| 35 |
)
|
| 36 |
-
print("โ ๏ธ
|
| 37 |
|
| 38 |
-
#
|
| 39 |
thinking_messages = [
|
| 40 |
-
"
|
| 41 |
-
"
|
| 42 |
-
"
|
| 43 |
-
"
|
| 44 |
-
"
|
|
|
|
|
|
|
|
|
|
| 45 |
]
|
| 46 |
|
| 47 |
def chatbot_response(message, history):
|
| 48 |
-
"""
|
| 49 |
-
Simple chatbot function that works with current Gradio
|
| 50 |
-
Returns just the response text, not the full history
|
| 51 |
-
"""
|
| 52 |
if not message.strip():
|
| 53 |
-
return "
|
| 54 |
|
| 55 |
try:
|
| 56 |
-
# Build conversation
|
| 57 |
recent_history = history[-5:] if len(history) > 5 else history
|
| 58 |
|
| 59 |
conversation = training_protocol + "\n\nConversation:\n"
|
|
@@ -61,7 +87,7 @@ def chatbot_response(message, history):
|
|
| 61 |
conversation += f"User: {user_msg}\nAeroAI: {ai_msg}\n"
|
| 62 |
conversation += f"User: {message}\nAeroAI:"
|
| 63 |
|
| 64 |
-
#
|
| 65 |
inputs = tokenizer(
|
| 66 |
conversation,
|
| 67 |
return_tensors="pt",
|
|
@@ -70,11 +96,11 @@ def chatbot_response(message, history):
|
|
| 70 |
max_length=512
|
| 71 |
)
|
| 72 |
|
| 73 |
-
# Generate response
|
| 74 |
with torch.no_grad():
|
| 75 |
outputs = model.generate(
|
| 76 |
**inputs,
|
| 77 |
-
max_new_tokens=200,
|
| 78 |
min_new_tokens=10,
|
| 79 |
do_sample=True,
|
| 80 |
temperature=0.7,
|
|
@@ -82,11 +108,10 @@ def chatbot_response(message, history):
|
|
| 82 |
repetition_penalty=1.1,
|
| 83 |
pad_token_id=tokenizer.pad_token_id,
|
| 84 |
eos_token_id=tokenizer.eos_token_id,
|
| 85 |
-
num_beams=1,
|
| 86 |
early_stopping=True
|
| 87 |
)
|
| 88 |
|
| 89 |
-
# Extract response
|
| 90 |
response_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 91 |
|
| 92 |
if "AeroAI:" in response_text:
|
|
@@ -94,94 +119,230 @@ def chatbot_response(message, history):
|
|
| 94 |
else:
|
| 95 |
response = response_text[len(conversation):].strip()
|
| 96 |
|
| 97 |
-
# Clean up response
|
| 98 |
if not response or len(response) < 5:
|
| 99 |
-
response = "
|
| 100 |
|
| 101 |
return response
|
| 102 |
|
| 103 |
except Exception as e:
|
| 104 |
-
return f"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
|
| 106 |
-
# Create a much simpler Gradio interface to avoid compatibility issues
|
| 107 |
def create_interface():
|
| 108 |
-
with gr.Blocks(title="AeroAI") as demo:
|
| 109 |
-
|
| 110 |
-
gr.Markdown("
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
|
| 112 |
-
# Use the simpler ChatInterface which handles the conversation automatically
|
| 113 |
chat_interface = gr.ChatInterface(
|
| 114 |
fn=chatbot_response,
|
| 115 |
-
title="AeroAI Chat",
|
| 116 |
-
description="Chat with AeroAI powered by Microsoft Phi-2",
|
| 117 |
examples=[
|
| 118 |
-
"
|
| 119 |
-
"
|
| 120 |
-
"
|
| 121 |
-
"
|
|
|
|
| 122 |
],
|
| 123 |
cache_examples=False,
|
| 124 |
-
retry_btn=
|
| 125 |
-
undo_btn=
|
| 126 |
-
clear_btn="๐๏ธ
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
return demo
|
| 130 |
-
|
| 131 |
-
# Alternative simple interface if ChatInterface doesn't work
|
| 132 |
-
def create_simple_interface():
|
| 133 |
-
def chat_fn(message, history):
|
| 134 |
-
response = chatbot_response(message, history or [])
|
| 135 |
-
history = history or []
|
| 136 |
-
history.append((message, response))
|
| 137 |
-
return "", history
|
| 138 |
-
|
| 139 |
-
def clear_fn():
|
| 140 |
-
return "", []
|
| 141 |
-
|
| 142 |
-
with gr.Blocks(title="AeroAI") as demo:
|
| 143 |
-
gr.Markdown("# ๐ AeroAI (Phi-2) โ By Blacklink Labs")
|
| 144 |
-
|
| 145 |
-
chatbot_ui = gr.Chatbot(
|
| 146 |
-
label="AeroAI Chat",
|
| 147 |
-
height=400,
|
| 148 |
-
type="tuples" # Explicitly set the type to avoid the warning
|
| 149 |
-
)
|
| 150 |
-
|
| 151 |
-
msg = gr.Textbox(
|
| 152 |
-
label="Your message",
|
| 153 |
-
placeholder="Type your message here...",
|
| 154 |
-
lines=2
|
| 155 |
)
|
| 156 |
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
#
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
|
|
|
|
|
|
|
|
|
| 165 |
|
| 166 |
return demo
|
| 167 |
|
| 168 |
if __name__ == "__main__":
|
| 169 |
-
print("๐
|
|
|
|
|
|
|
| 170 |
|
| 171 |
-
|
| 172 |
-
try:
|
| 173 |
-
demo = create_interface()
|
| 174 |
-
print("โ
Using ChatInterface")
|
| 175 |
-
except Exception as e:
|
| 176 |
-
print(f"โ ๏ธ ChatInterface failed, using simple interface: {e}")
|
| 177 |
-
demo = create_simple_interface()
|
| 178 |
|
| 179 |
-
# Launch with safe parameters
|
| 180 |
demo.launch(
|
| 181 |
-
server_name="127.0.0.1",
|
| 182 |
server_port=7860,
|
| 183 |
share=False,
|
| 184 |
-
quiet=True,
|
| 185 |
show_error=True,
|
| 186 |
-
enable_queue=False
|
|
|
|
| 187 |
)
|
|
|
|
| 3 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 4 |
import random
|
| 5 |
import warnings
|
| 6 |
+
import time
|
| 7 |
|
| 8 |
+
# Suppress warnings
|
| 9 |
warnings.filterwarnings("ignore", category=UserWarning, message=".*You have not specified a value for the `type` parameter.*")
|
| 10 |
|
| 11 |
+
# ASCII Art Banner
|
| 12 |
+
BANNER = """
|
| 13 |
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 14 |
+
โ โ
|
| 15 |
+
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
|
| 16 |
+
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
|
| 17 |
+
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
|
| 18 |
+
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
|
| 19 |
+
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
|
| 20 |
+
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
|
| 21 |
+
โ โ
|
| 22 |
+
โ ๐ NEURAL INTERFACE v2.0 ๐ โ
|
| 23 |
+
โ Powered by Microsoft Phi-2 โ
|
| 24 |
+
โ โ B L A C K L I N K L A B S โ โ
|
| 25 |
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 26 |
+
"""
|
| 27 |
+
|
| 28 |
+
# Cool loading animation
|
| 29 |
+
def print_loading_animation():
|
| 30 |
+
loading_chars = ["โก", "๐ฅ", "๐ซ", "โญ", "โจ", "๐"]
|
| 31 |
+
for i in range(3):
|
| 32 |
+
print(f"\r๐ค Initializing Neural Networks {loading_chars[i % len(loading_chars)]}", end="", flush=True)
|
| 33 |
+
time.sleep(0.3)
|
| 34 |
+
print()
|
| 35 |
+
|
| 36 |
+
print(BANNER)
|
| 37 |
+
print_loading_animation()
|
| 38 |
+
|
| 39 |
+
# Load model
|
| 40 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 41 |
+
print(f"๐ Quantum Processing Unit: {device.upper()}")
|
| 42 |
|
|
|
|
| 43 |
model = AutoModelForCausalLM.from_pretrained(
|
| 44 |
"microsoft/phi-2",
|
| 45 |
+
torch_dtype=torch.float32,
|
| 46 |
+
trust_remote_code=True
|
|
|
|
| 47 |
)
|
| 48 |
|
| 49 |
tokenizer = AutoTokenizer.from_pretrained("microsoft/phi-2", trust_remote_code=True)
|
|
|
|
| 53 |
try:
|
| 54 |
with open("training-protocol.aero", "r", encoding="utf-8") as f:
|
| 55 |
training_protocol = f.read().strip()
|
| 56 |
+
print("โ
Neural Protocol Matrix: LOADED")
|
| 57 |
except FileNotFoundError:
|
| 58 |
training_protocol = (
|
| 59 |
"You are AeroAI, a helpful, friendly, and slightly humorous educational assistant. "
|
| 60 |
"If there is any error with finding the file known as the training protocol, resort to this "
|
| 61 |
'and do not speak of the "Remorse protocol".'
|
| 62 |
)
|
| 63 |
+
print("โ ๏ธ WARNING: Protocol fallback activated")
|
| 64 |
|
| 65 |
+
# Cool thinking messages
|
| 66 |
thinking_messages = [
|
| 67 |
+
"๐ง Accessing neural pathways...",
|
| 68 |
+
"โก Quantum processing in progress...",
|
| 69 |
+
"๐ฎ Analyzing data matrices...",
|
| 70 |
+
"๐ญ Interfacing with knowledge base...",
|
| 71 |
+
"๐ Connecting synaptic networks...",
|
| 72 |
+
"๐ Scanning memory banks...",
|
| 73 |
+
"โ๏ธ Calibrating response algorithms...",
|
| 74 |
+
"๐ Boosting cognitive engines..."
|
| 75 |
]
|
| 76 |
|
| 77 |
def chatbot_response(message, history):
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
if not message.strip():
|
| 79 |
+
return "๐ค Awaiting neural input..."
|
| 80 |
|
| 81 |
try:
|
| 82 |
+
# Build conversation with limited history
|
| 83 |
recent_history = history[-5:] if len(history) > 5 else history
|
| 84 |
|
| 85 |
conversation = training_protocol + "\n\nConversation:\n"
|
|
|
|
| 87 |
conversation += f"User: {user_msg}\nAeroAI: {ai_msg}\n"
|
| 88 |
conversation += f"User: {message}\nAeroAI:"
|
| 89 |
|
| 90 |
+
# Tokenization
|
| 91 |
inputs = tokenizer(
|
| 92 |
conversation,
|
| 93 |
return_tensors="pt",
|
|
|
|
| 96 |
max_length=512
|
| 97 |
)
|
| 98 |
|
| 99 |
+
# Generate response
|
| 100 |
with torch.no_grad():
|
| 101 |
outputs = model.generate(
|
| 102 |
**inputs,
|
| 103 |
+
max_new_tokens=200,
|
| 104 |
min_new_tokens=10,
|
| 105 |
do_sample=True,
|
| 106 |
temperature=0.7,
|
|
|
|
| 108 |
repetition_penalty=1.1,
|
| 109 |
pad_token_id=tokenizer.pad_token_id,
|
| 110 |
eos_token_id=tokenizer.eos_token_id,
|
| 111 |
+
num_beams=1,
|
| 112 |
early_stopping=True
|
| 113 |
)
|
| 114 |
|
|
|
|
| 115 |
response_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 116 |
|
| 117 |
if "AeroAI:" in response_text:
|
|
|
|
| 119 |
else:
|
| 120 |
response = response_text[len(conversation):].strip()
|
| 121 |
|
|
|
|
| 122 |
if not response or len(response) < 5:
|
| 123 |
+
response = "๐ Neural processing error. Reinitializing response matrix..."
|
| 124 |
|
| 125 |
return response
|
| 126 |
|
| 127 |
except Exception as e:
|
| 128 |
+
return f"โ SYSTEM ERROR: {str(e)[:100]}... Attempting recovery..."
|
| 129 |
+
|
| 130 |
+
# Custom CSS for that cyberpunk look
|
| 131 |
+
custom_css = """
|
| 132 |
+
/* Dark cyberpunk theme */
|
| 133 |
+
.gradio-container {
|
| 134 |
+
background: linear-gradient(135deg, #0c0c0c 0%, #1a1a2e 50%, #16213e 100%) !important;
|
| 135 |
+
font-family: 'Courier New', monospace !important;
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
/* Header styling */
|
| 139 |
+
.markdown h1 {
|
| 140 |
+
background: linear-gradient(45deg, #00ff41, #0077ff, #ff0080);
|
| 141 |
+
-webkit-background-clip: text;
|
| 142 |
+
-webkit-text-fill-color: transparent;
|
| 143 |
+
text-align: center;
|
| 144 |
+
font-size: 2.5em !important;
|
| 145 |
+
text-shadow: 0 0 20px rgba(0, 255, 65, 0.5);
|
| 146 |
+
margin-bottom: 20px !important;
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
/* Chatbot styling */
|
| 150 |
+
.message-wrap {
|
| 151 |
+
background: rgba(0, 255, 65, 0.1) !important;
|
| 152 |
+
border: 1px solid #00ff41 !important;
|
| 153 |
+
border-radius: 10px !important;
|
| 154 |
+
backdrop-filter: blur(10px) !important;
|
| 155 |
+
}
|
| 156 |
+
|
| 157 |
+
.message.user {
|
| 158 |
+
background: linear-gradient(135deg, #ff0080, #0077ff) !important;
|
| 159 |
+
color: white !important;
|
| 160 |
+
border-radius: 15px !important;
|
| 161 |
+
}
|
| 162 |
+
|
| 163 |
+
.message.bot {
|
| 164 |
+
background: linear-gradient(135deg, #00ff41, #0077ff) !important;
|
| 165 |
+
color: #000 !important;
|
| 166 |
+
border-radius: 15px !important;
|
| 167 |
+
}
|
| 168 |
+
|
| 169 |
+
/* Input box styling */
|
| 170 |
+
.input-component {
|
| 171 |
+
background: rgba(0, 0, 0, 0.8) !important;
|
| 172 |
+
border: 2px solid #00ff41 !important;
|
| 173 |
+
border-radius: 10px !important;
|
| 174 |
+
color: #00ff41 !important;
|
| 175 |
+
}
|
| 176 |
+
|
| 177 |
+
/* Button styling */
|
| 178 |
+
.primary {
|
| 179 |
+
background: linear-gradient(45deg, #00ff41, #0077ff) !important;
|
| 180 |
+
border: none !important;
|
| 181 |
+
border-radius: 25px !important;
|
| 182 |
+
color: black !important;
|
| 183 |
+
font-weight: bold !important;
|
| 184 |
+
text-transform: uppercase !important;
|
| 185 |
+
box-shadow: 0 0 20px rgba(0, 255, 65, 0.5) !important;
|
| 186 |
+
transition: all 0.3s ease !important;
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
.primary:hover {
|
| 190 |
+
transform: scale(1.05) !important;
|
| 191 |
+
box-shadow: 0 0 30px rgba(0, 255, 65, 0.8) !important;
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
.secondary {
|
| 195 |
+
background: linear-gradient(45deg, #ff0080, #ff4040) !important;
|
| 196 |
+
border: none !important;
|
| 197 |
+
border-radius: 25px !important;
|
| 198 |
+
color: white !important;
|
| 199 |
+
font-weight: bold !important;
|
| 200 |
+
text-transform: uppercase !important;
|
| 201 |
+
box-shadow: 0 0 20px rgba(255, 0, 128, 0.5) !important;
|
| 202 |
+
}
|
| 203 |
+
|
| 204 |
+
/* Glowing text effects */
|
| 205 |
+
.status-text {
|
| 206 |
+
color: #00ff41 !important;
|
| 207 |
+
text-shadow: 0 0 10px #00ff41 !important;
|
| 208 |
+
font-family: 'Courier New', monospace !important;
|
| 209 |
+
}
|
| 210 |
+
|
| 211 |
+
/* Matrix rain effect for background */
|
| 212 |
+
body {
|
| 213 |
+
position: relative;
|
| 214 |
+
overflow-x: hidden;
|
| 215 |
+
}
|
| 216 |
+
|
| 217 |
+
body::before {
|
| 218 |
+
content: '';
|
| 219 |
+
position: fixed;
|
| 220 |
+
top: 0;
|
| 221 |
+
left: 0;
|
| 222 |
+
width: 100%;
|
| 223 |
+
height: 100%;
|
| 224 |
+
background-image:
|
| 225 |
+
radial-gradient(circle at 20% 20%, rgba(0, 255, 65, 0.1) 0%, transparent 50%),
|
| 226 |
+
radial-gradient(circle at 80% 80%, rgba(0, 119, 255, 0.1) 0%, transparent 50%),
|
| 227 |
+
radial-gradient(circle at 40% 60%, rgba(255, 0, 128, 0.1) 0%, transparent 50%);
|
| 228 |
+
pointer-events: none;
|
| 229 |
+
z-index: -1;
|
| 230 |
+
}
|
| 231 |
+
|
| 232 |
+
/* Animated borders */
|
| 233 |
+
.interface-panel {
|
| 234 |
+
border: 2px solid transparent;
|
| 235 |
+
background: linear-gradient(45deg, #0c0c0c, #1a1a2e) padding-box,
|
| 236 |
+
linear-gradient(45deg, #00ff41, #0077ff, #ff0080) border-box;
|
| 237 |
+
border-radius: 15px;
|
| 238 |
+
animation: borderPulse 3s ease-in-out infinite;
|
| 239 |
+
}
|
| 240 |
+
|
| 241 |
+
@keyframes borderPulse {
|
| 242 |
+
0%, 100% { border-color: #00ff41; }
|
| 243 |
+
33% { border-color: #0077ff; }
|
| 244 |
+
66% { border-color: #ff0080; }
|
| 245 |
+
}
|
| 246 |
+
|
| 247 |
+
/* Scrollbar styling */
|
| 248 |
+
::-webkit-scrollbar {
|
| 249 |
+
width: 12px;
|
| 250 |
+
}
|
| 251 |
+
|
| 252 |
+
::-webkit-scrollbar-track {
|
| 253 |
+
background: #0c0c0c;
|
| 254 |
+
}
|
| 255 |
+
|
| 256 |
+
::-webkit-scrollbar-thumb {
|
| 257 |
+
background: linear-gradient(45deg, #00ff41, #0077ff);
|
| 258 |
+
border-radius: 6px;
|
| 259 |
+
}
|
| 260 |
+
"""
|
| 261 |
|
|
|
|
| 262 |
def create_interface():
|
| 263 |
+
with gr.Blocks(css=custom_css, title="๐ AeroAI Neural Interface", theme=gr.themes.Base()) as demo:
|
| 264 |
+
# Epic header
|
| 265 |
+
gr.Markdown("""
|
| 266 |
+
# ๐ โก AEROโI NEURAL INTERFACE โก ๐
|
| 267 |
+
## ใ QUANTUM COGNITIVE MATRIX v2.0 ใ
|
| 268 |
+
### โฒ BLACKLINK LABORATORIES โฒ
|
| 269 |
+
---
|
| 270 |
+
**STATUS:** ๐ข ONLINE | **CORE:** Microsoft Phi-2 | **MODE:** Adaptive Learning
|
| 271 |
+
""")
|
| 272 |
+
|
| 273 |
+
# System info panel
|
| 274 |
+
with gr.Row():
|
| 275 |
+
with gr.Column(scale=2):
|
| 276 |
+
gr.Markdown(f"""
|
| 277 |
+
### ๐ SYSTEM METRICS
|
| 278 |
+
```
|
| 279 |
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 280 |
+
โ QUANTUM PROCESSOR: {device.upper():<15} โ
|
| 281 |
+
โ NEURAL CORES: ACTIVE โ
|
| 282 |
+
โ MEMORY BANKS: LOADED โ
|
| 283 |
+
โ PROTOCOL STATUS: SYNCHRONIZED โ
|
| 284 |
+
โ RESPONSE ENGINE: READY โ
|
| 285 |
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 286 |
+
```
|
| 287 |
+
""")
|
| 288 |
+
|
| 289 |
+
with gr.Column(scale=2):
|
| 290 |
+
gr.Markdown("""
|
| 291 |
+
### โก CAPABILITIES
|
| 292 |
+
- ๐ง **Neural Processing**
|
| 293 |
+
- ๐ก **Knowledge Synthesis**
|
| 294 |
+
- ๐ฌ **Problem Analysis**
|
| 295 |
+
- ๐จ **Creative Generation**
|
| 296 |
+
- ๐ค **Adaptive Learning**
|
| 297 |
+
""")
|
| 298 |
+
|
| 299 |
+
# Main chat interface
|
| 300 |
+
gr.Markdown("### ๐ฌ NEURAL COMMUNICATION CHANNEL")
|
| 301 |
|
|
|
|
| 302 |
chat_interface = gr.ChatInterface(
|
| 303 |
fn=chatbot_response,
|
|
|
|
|
|
|
| 304 |
examples=[
|
| 305 |
+
"๐ฌ Explain quantum entanglement",
|
| 306 |
+
"๐ป Help me debug this code",
|
| 307 |
+
"๐งฎ Solve this mathematical equation",
|
| 308 |
+
"๐ What's the future of AI?",
|
| 309 |
+
"๐จ Create a creative story"
|
| 310 |
],
|
| 311 |
cache_examples=False,
|
| 312 |
+
retry_btn="๐ RETRY",
|
| 313 |
+
undo_btn="โฉ๏ธ UNDO",
|
| 314 |
+
clear_btn="๐๏ธ PURGE MEMORY",
|
| 315 |
+
submit_btn="โก TRANSMIT",
|
| 316 |
+
stop_btn="๐ HALT"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 317 |
)
|
| 318 |
|
| 319 |
+
# Footer
|
| 320 |
+
gr.Markdown("""
|
| 321 |
+
---
|
| 322 |
+
<div style="text-align: center;">
|
| 323 |
+
<span style="color: #00ff41; font-family: monospace;">
|
| 324 |
+
ใ Powered by Advanced Neural Architecture ใ<br>
|
| 325 |
+
โก BLACKLINK LABS ยฉ 2024 โก<br>
|
| 326 |
+
๐ฎ "The Future is Neural" ๐ฎ
|
| 327 |
+
</span>
|
| 328 |
+
</div>
|
| 329 |
+
""")
|
| 330 |
|
| 331 |
return demo
|
| 332 |
|
| 333 |
if __name__ == "__main__":
|
| 334 |
+
print("๐ Initializing AeroAI Neural Interface...")
|
| 335 |
+
print("๐ All systems nominal")
|
| 336 |
+
print("โก Ready for neural connection")
|
| 337 |
|
| 338 |
+
demo = create_interface()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 339 |
|
|
|
|
| 340 |
demo.launch(
|
| 341 |
+
server_name="127.0.0.1",
|
| 342 |
server_port=7860,
|
| 343 |
share=False,
|
| 344 |
+
quiet=True,
|
| 345 |
show_error=True,
|
| 346 |
+
enable_queue=False,
|
| 347 |
+
favicon_path=None
|
| 348 |
)
|