KAT-Dev / app.py
akhaliq's picture
akhaliq HF Staff
Update app.py
a5660ec verified
import gradio as gr
from models import stream_generate_response
# Header Link
ANYCODER_LINK = "<a href='https://huggingface.co/spaces/akhaliq/anycoder' target='_blank'>Built with anycoder</a>"
with gr.Blocks(title="KAT-Dev Chat", theme=gr.themes.Soft()) as demo:
gr.HTML(
f"""
<div style="text-align: center; max-width: 800px; margin: 0 auto;">
<h1>💬 KAT-Dev LLM Chat</h1>
<p>Powered by Kwaipilot/KAT-Dev, a large language model. This application uses Hugging Face ZeroGPU for highly efficient inference.</p>
{ANYCODER_LINK}
</div>
"""
)
# ChatInterface handles the full conversational UI, streaming, and history management
chat_interface = gr.ChatInterface(
fn=stream_generate_response,
title="", # Title moved to HTML block
chatbot=gr.Chatbot(
height=500,
show_copy_button=True,
layout="bubble"
),
textbox=gr.Textbox(
placeholder="Ask the KAT model anything...",
container=False,
scale=7
),
# Disable the default submit button text since we have an icon
submit_btn=True,
stop_btn=True,
# Concurrency limit handled by @spaces.GPU
concurrency_limit=10,
)
demo.queue()
demo.launch()