|
|
import gradio as gr |
|
|
from models import stream_generate_response |
|
|
|
|
|
|
|
|
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> |
|
|
""" |
|
|
) |
|
|
|
|
|
|
|
|
chat_interface = gr.ChatInterface( |
|
|
fn=stream_generate_response, |
|
|
title="", |
|
|
chatbot=gr.Chatbot( |
|
|
height=500, |
|
|
show_copy_button=True, |
|
|
layout="bubble" |
|
|
), |
|
|
textbox=gr.Textbox( |
|
|
placeholder="Ask the KAT model anything...", |
|
|
container=False, |
|
|
scale=7 |
|
|
), |
|
|
|
|
|
submit_btn=True, |
|
|
stop_btn=True, |
|
|
|
|
|
|
|
|
concurrency_limit=10, |
|
|
) |
|
|
|
|
|
demo.queue() |
|
|
demo.launch() |