Update app.py
Browse files
app.py
CHANGED
@@ -43,8 +43,8 @@ This demo allows you to have a conversation with Sesame CSM 1B, leveraging Whisp
|
|
43 |
|
44 |
# --- Constants --- (Constants can stay outside)
|
45 |
SPEAKER_ID = 0
|
46 |
-
MAX_CONTEXT_SEGMENTS =
|
47 |
-
MAX_GEMMA_LENGTH =
|
48 |
|
49 |
# --- Global Conversation History ---
|
50 |
conversation_history = []
|
@@ -65,7 +65,7 @@ def generate_response(text: str, model_gemma, tokenizer_gemma, device) -> str: #
|
|
65 |
try:
|
66 |
# Gemma 3 chat template format
|
67 |
messages = [{"role": "user", "content": text}]
|
68 |
-
input = tokenizer_gemma.apply_chat_template(messages, return_tensors="pt").to(device)
|
69 |
generation_config = GenerationConfig(
|
70 |
max_new_tokens=MAX_GEMMA_LENGTH,
|
71 |
early_stopping=True,
|
|
|
43 |
|
44 |
# --- Constants --- (Constants can stay outside)
|
45 |
SPEAKER_ID = 0
|
46 |
+
MAX_CONTEXT_SEGMENTS = 3
|
47 |
+
MAX_GEMMA_LENGTH = 128
|
48 |
|
49 |
# --- Global Conversation History ---
|
50 |
conversation_history = []
|
|
|
65 |
try:
|
66 |
# Gemma 3 chat template format
|
67 |
messages = [{"role": "user", "content": text}]
|
68 |
+
input = tokenizer_gemma.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt").to(device)
|
69 |
generation_config = GenerationConfig(
|
70 |
max_new_tokens=MAX_GEMMA_LENGTH,
|
71 |
early_stopping=True,
|