Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,7 +3,7 @@ from huggingface_hub import InferenceClient
|
|
| 3 |
import os
|
| 4 |
|
| 5 |
# ============================================
|
| 6 |
-
#
|
| 7 |
# Provider: Novita (HuggingFace)
|
| 8 |
# Gradio 6.0 Compatible - Full Width Layout
|
| 9 |
# ============================================
|
|
@@ -17,7 +17,7 @@ client = InferenceClient(
|
|
| 17 |
def chat_stream(messages):
|
| 18 |
"""Streaming via Novita provider"""
|
| 19 |
stream = client.chat.completions.create(
|
| 20 |
-
model="
|
| 21 |
messages=messages,
|
| 22 |
max_tokens=4096,
|
| 23 |
temperature=0.7,
|
|
@@ -42,7 +42,7 @@ def chat_respond(message, history):
|
|
| 42 |
# Build API messages
|
| 43 |
api_messages = [{
|
| 44 |
"role": "system",
|
| 45 |
-
"content": "You are
|
| 46 |
}]
|
| 47 |
|
| 48 |
# Add history (Gradio 6.0 messages format)
|
|
@@ -213,16 +213,16 @@ with gr.Blocks(fill_height=True) as demo:
|
|
| 213 |
""")
|
| 214 |
|
| 215 |
# Header Title
|
| 216 |
-
gr.Markdown("""#
|
| 217 |
-
gr.Markdown("""<p class="subtitle">
|
| 218 |
|
| 219 |
# Model Info Box
|
| 220 |
gr.HTML("""
|
| 221 |
-
<div style="background: linear-gradient(135deg, #
|
| 222 |
<div style="display: flex; justify-content: space-around; flex-wrap: wrap; text-align: center;">
|
| 223 |
-
<div><strong style="font-size: 1.5rem;">
|
| 224 |
-
<div><strong style="font-size: 1.5rem;">
|
| 225 |
-
<div><strong style="font-size: 1.5rem;">
|
| 226 |
<div><strong style="font-size: 1.5rem;">Novita</strong><br><span style="font-size: 0.9rem;">Provider</span></div>
|
| 227 |
</div>
|
| 228 |
</div>
|
|
|
|
| 3 |
import os
|
| 4 |
|
| 5 |
# ============================================
|
| 6 |
+
# Kimi-K2-Thinking Streaming Chat
|
| 7 |
# Provider: Novita (HuggingFace)
|
| 8 |
# Gradio 6.0 Compatible - Full Width Layout
|
| 9 |
# ============================================
|
|
|
|
| 17 |
def chat_stream(messages):
|
| 18 |
"""Streaming via Novita provider"""
|
| 19 |
stream = client.chat.completions.create(
|
| 20 |
+
model="moonshotai/Kimi-K2-Thinking",
|
| 21 |
messages=messages,
|
| 22 |
max_tokens=4096,
|
| 23 |
temperature=0.7,
|
|
|
|
| 42 |
# Build API messages
|
| 43 |
api_messages = [{
|
| 44 |
"role": "system",
|
| 45 |
+
"content": "You are Kimi-K2-Thinking, a helpful AI assistant built by Moonshot AI. You excel at deep reasoning, coding, and complex problem solving. Respond in the same language as the user."
|
| 46 |
}]
|
| 47 |
|
| 48 |
# Add history (Gradio 6.0 messages format)
|
|
|
|
| 213 |
""")
|
| 214 |
|
| 215 |
# Header Title
|
| 216 |
+
gr.Markdown("""# Kimi-K2-Thinking CHAT""", elem_classes="header-text")
|
| 217 |
+
gr.Markdown("""<p class="subtitle">Moonshot AI's Advanced Reasoning Model - Deep Thinking and Complex Problem Solving</p>""")
|
| 218 |
|
| 219 |
# Model Info Box
|
| 220 |
gr.HTML("""
|
| 221 |
+
<div style="background: linear-gradient(135deg, #EC4899 0%, #F97316 100%); border: 3px solid #1F2937; border-radius: 12px; padding: 15px; color: white; box-shadow: 5px 5px 0px #1F2937; margin: 0 auto 20px auto; max-width: 1200px;">
|
| 222 |
<div style="display: flex; justify-content: space-around; flex-wrap: wrap; text-align: center;">
|
| 223 |
+
<div><strong style="font-size: 1.5rem;">Kimi-K2</strong><br><span style="font-size: 0.9rem;">Model</span></div>
|
| 224 |
+
<div><strong style="font-size: 1.5rem;">Moonshot AI</strong><br><span style="font-size: 0.9rem;">Developer</span></div>
|
| 225 |
+
<div><strong style="font-size: 1.5rem;">Thinking</strong><br><span style="font-size: 0.9rem;">Mode</span></div>
|
| 226 |
<div><strong style="font-size: 1.5rem;">Novita</strong><br><span style="font-size: 0.9rem;">Provider</span></div>
|
| 227 |
</div>
|
| 228 |
</div>
|