Spaces:
Runtime error
Runtime error
File size: 3,268 Bytes
978c0a4 6ad39cb 978c0a4 8d98bb7 6ad39cb 8d98bb7 485d166 6ad39cb 978c0a4 6ad39cb 485d166 6ad39cb 8d98bb7 88dce75 8d98bb7 88dce75 8d98bb7 88dce75 6ad39cb 978c0a4 8d98bb7 6ad39cb 978c0a4 8d98bb7 708af78 6ad39cb 708af78 6ad39cb 88dce75 6ad39cb 485d166 6ad39cb 708af78 978c0a4 6ad39cb 8d98bb7 6ad39cb 978c0a4 708af78 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | import gradio as gr
from transformers import pipeline
# 1. Model Logic - Mapping personas to specialized coding models
MODELS = {
"ZewAI 3 (Core)": "microsoft/phi-2",
"ZewAI 3 (Python Pro)": "Salesforce/codet5p-220m",
"ZewAI 3 (Web Master)": "bigcode/starcoder2-3b",
"ZewAI 3 (The AI itself)": "Zakomako4567/ZewAI_3.9_Code" # FIXED Syntax Error here
}
def chat_engine(message, history, model_choice):
# Added trust_remote_code=True for custom model compatibility
pipe = pipeline("text-generation", model=MODELS[model_choice], trust_remote_code=True)
prompt = f"System: You are {model_choice}, the flagship AI of Zakomako4567. Use clean code and detailed logic.\n"
for turn in history:
role = turn['role']
content = turn['content']
if role == 'user':
prompt += f"User: {content}\n"
else:
prompt += f"AI: {content}\n"
prompt += f"User: {message}\nAI:"
res = pipe(prompt, max_new_tokens=512, do_sample=True, temperature=0.7)[0]['generated_text']
return res.split("AI:")[-1].strip()
# Advanced CSS for the ZewAI "Premium" look
custom_css = """
footer {visibility: hidden}
.gradio-container { background: #050505 !important; color: white !important; }
#title-header { text-align: center; padding: 20px; border-bottom: 2px solid #1e293b; }
.app-card {
background: #111827;
padding: 15px;
border-radius: 12px;
text-align: center;
border: 1px solid #374151;
transition: 0.3s;
}
.app-card:hover { border-color: #3b82f6; transform: translateY(-3px); }
"""
# 2. Building the Workspace
with gr.Blocks() as demo:
with gr.Column(elem_id="title-header"):
gr.Markdown(f"# π ZewAI 3 by @Zakomako4567")
gr.Markdown("The flagship coding AI for the ZewpolOS ecosystem.")
with gr.Row():
with gr.Column(scale=1, variant="panel"):
gr.Markdown("### π€ User Account")
gr.LoginButton()
gr.Markdown("---")
gr.Markdown("### π§ Neural Presets")
model_dropdown = gr.Dropdown(
choices=list(MODELS.keys()),
value="ZewAI 3 (Core)",
label="Active Brain"
)
gr.Markdown("---")
gr.Markdown("### π Zewpol Ecosystem")
with gr.Row():
gr.HTML('<div class="app-card"><a href="https://huggingface.co/Zakomako4567" target="_blank" style="text-decoration:none; color:white;">π Profile</a></div>')
gr.HTML('<div class="app-card"><a href="#" style="text-decoration:none; color:white;">π Projects</a></div>')
with gr.Column(scale=4):
gr.ChatInterface(
fn=chat_engine,
additional_inputs=[model_dropdown],
examples=[
["Build a Python web scraper", "ZewAI 3 (Core)"],
["Explain ZewML logic", "ZewAI 3 (Core)"],
["Write a C kernel loop for ZewpolOS", "ZewAI 3 (Python Pro)"]
],
)
if __name__ == "__main__":
demo.launch(
css=custom_css,
theme=gr.themes.Default(primary_hue="blue", secondary_hue="slate")
)
|