lpt-6 / app.py
liskasYR's picture
LiskCell LPT-6 (Deta) with Official Branding & Native Chat Template
9fe7298 verified
import gradio as gr
from huggingface_hub import InferenceClient
import os
# --- BRANDING & IDENTITY ---
TITLE = "💎 LPT-6 (Deta) | LiskCell Official Tester"
SUBTITLE = "Experience the next generation of creative AI by LiskCell & xLYR."
DESCRIPTION = """
Welcome to the testing sandbox for **LPT-6**, the flagship model of the **LiskCell** ecosystem.
Natively powered by **Deta**, this model combines technical precision with an artistic soul.
Founded by **liskasYR** (Yonatan Yosupov), LiskCell pushes the boundaries of AI, art, and music 🎵.
"""
# Theme / CSS for Futuristic Look
custom_css = """
body { background-color: #0b0f19; color: #e2e8f0; }
.gradio-container { border: 1px solid #1e293b !important; border-radius: 20px !important; background: rgba(15, 23, 42, 0.8) !ax; backdrop-filter: blur(10px); }
#component-0 { background: transparent !important; }
.message.user { background-color: #1e293b !important; border-radius: 15px 15px 0 15px !important; }
.message.bot { background-color: #0f172a !important; border: 1px solid #3b82f6 !important; border-radius: 15px 15px 15px 0 !important; }
footer { display: none !important; }
#title-header { text-align: center; margin-bottom: 20px; }
#title-header h1 { color: #38bdf8; text-shadow: 0 0 10px rgba(56, 189, 248, 0.5); font-family: 'Inter', sans-serif; }
"""
# Initialize Inference Client
# Note: Use an environment variable for the token in Space settings or a default public access if allowed.
# For this tester, we'll try to use the model's inference endpoint.
repo_id = "liskcell-company/lpt-6"
client = InferenceClient(model=repo_id)
def respond(message, history):
messages = []
# Add System Prompt (Deta Persona) - although it's baked in, we reinforce it here for the UI
# Since the user said it's "Baked in", we'll just send the chat history.
for user_msg, assistant_msg in history:
messages.append({"role": "user", "content": user_msg})
messages.append({"role": "assistant", "content": assistant_msg})
messages.append({"role": "user", "content": message})
response = ""
try:
# Stream the response
for message_chunk in client.chat_completion(
messages,
max_tokens=1024,
stream=True,
temperature=0.7,
top_p=0.9,
):
token = message_chunk.choices[0].delta.content
if token:
response += token
yield response
except Exception as e:
yield f"⚠️ **Error:** {str(e)}\n\nPlease make sure the Inference Endpoint for {repo_id} is active."
# Create the Gradio Interface
with gr.Blocks(theme=gr.themes.Soft(), css=custom_css) as demo:
with gr.Column(elem_id="title-header"):
gr.Markdown(f"# {TITLE}")
gr.Markdown(f"### {SUBTITLE}")
gr.Markdown(DESCRIPTION)
chatbot = gr.Chatbot(
bubble_full_width=False,
show_label=False,
show_share_button=False,
show_copy_button=True,
layout="panel",
height=600,
)
with gr.Row():
msg = gr.Textbox(
placeholder="Talk to Deta... (English or Hebrew)",
show_label=False,
scale=9,
container=False
)
submit_btn = gr.Button("🚀 Send", scale=1, variant="primary")
msg.submit(respond, [msg, chatbot], [chatbot])
msg.submit(lambda: "", None, [msg])
submit_btn.click(respond, [msg, chatbot], [chatbot])
submit_btn.click(lambda: "", None, [msg])
gr.Examples(
examples=[
["היי Deta, ספרי לי על עצמך ועל LiskCell."],
["What makes LPT-6 better than previous models?"],
["Could you help me brainstorm a concept for a futuristic music app?"],
["כתבי לי שיר קצר על עתיד הטכנולוגיה."]
],
inputs=msg,
label="Quick Examples"
)
gr.Markdown("---")
gr.Markdown("Powered by **LiskCell & xLYR** 💎 | Founded by **liskasYR**")
if __name__ == "__main__":
demo.launch()