Update app.py
Browse files
app.py
CHANGED
|
@@ -3,14 +3,8 @@ from transformers import AutoTokenizer, AutoModelForCausalLM, TextIteratorStream
|
|
| 3 |
import torch
|
| 4 |
from threading import Thread
|
| 5 |
MODEL_NAMES = {
|
| 6 |
-
"
|
| 7 |
-
"
|
| 8 |
-
"LFM2-1.2B": "LiquidAI/LFM2-1.2B", # LFM2 - 1.2B
|
| 9 |
-
"LFM2.5-1.2B": "LiquidAI/LFM2.5-1.2B-Instruct", # LFM2.5 - 1.2B
|
| 10 |
-
"LFM2.5-1.2B-Thinking": "LiquidAI/LFM2.5-1.2B-Thinking", # LFM2.5 - 1.2B (Thinking)
|
| 11 |
-
"LFM2-2.6B": "LiquidAI/LFM2-2.6B", # LFM2 - 2.6B
|
| 12 |
-
"LFM2-8B-A1B": "LiquidAI/LFM2-8B-A1B", # LFM2 - 8B-A1B
|
| 13 |
-
"LFM2-24B-A3B": "LiquidAI/LFM2-24B-A2B", # LFM2 - 24B-A3B
|
| 14 |
}
|
| 15 |
model_cache = {}
|
| 16 |
def load_model(model_key):
|
|
@@ -55,19 +49,19 @@ def chat_with_model(message, history, model_choice):
|
|
| 55 |
{"role": "assistant", "content": partial_text},
|
| 56 |
]
|
| 57 |
def create_demo():
|
| 58 |
-
with gr.Blocks(title="
|
| 59 |
-
gr.Markdown("##
|
| 60 |
model_choice = gr.Dropdown(
|
| 61 |
label="Select Model",
|
| 62 |
choices=list(MODEL_NAMES.keys()),
|
| 63 |
-
value="
|
| 64 |
)
|
| 65 |
chatbot = gr.Chatbot(
|
| 66 |
-
label="Chat with
|
| 67 |
type="messages",
|
| 68 |
height=450
|
| 69 |
)
|
| 70 |
-
msg = gr.Textbox(label="Your message", placeholder="Type
|
| 71 |
clear = gr.Button("Clear")
|
| 72 |
def add_user_message(user_message, chat_history):
|
| 73 |
chat_history = chat_history + [{"role": "user", "content": user_message}]
|
|
|
|
| 3 |
import torch
|
| 4 |
from threading import Thread
|
| 5 |
MODEL_NAMES = {
|
| 6 |
+
"dqnCode v0.2 1.5B": "DQN-Labs/dqnCode-v0.2-1.5B-HF",
|
| 7 |
+
"dqnCode v0.3 1.2B": "DQN-Labs/dqnCode-v0.3-1.2B-MLX-4bit",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
}
|
| 9 |
model_cache = {}
|
| 10 |
def load_model(model_key):
|
|
|
|
| 49 |
{"role": "assistant", "content": partial_text},
|
| 50 |
]
|
| 51 |
def create_demo():
|
| 52 |
+
with gr.Blocks(title="DQN Labs Chat") as demo:
|
| 53 |
+
gr.Markdown("## DQN Labs Chat")
|
| 54 |
model_choice = gr.Dropdown(
|
| 55 |
label="Select Model",
|
| 56 |
choices=list(MODEL_NAMES.keys()),
|
| 57 |
+
value="dqnCode v0.2 1.5B"
|
| 58 |
)
|
| 59 |
chatbot = gr.Chatbot(
|
| 60 |
+
label="Chat with DQN!",
|
| 61 |
type="messages",
|
| 62 |
height=450
|
| 63 |
)
|
| 64 |
+
msg = gr.Textbox(label="Your message", placeholder="Type away...")
|
| 65 |
clear = gr.Button("Clear")
|
| 66 |
def add_user_message(user_message, chat_history):
|
| 67 |
chat_history = chat_history + [{"role": "user", "content": user_message}]
|