Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -62,7 +62,7 @@ MODELS = sorted(list(models.keys()))
|
|
| 62 |
|
| 63 |
|
| 64 |
def generate_prompt_with_history(
|
| 65 |
-
text, image,
|
| 66 |
):
|
| 67 |
"""
|
| 68 |
Generate a prompt with history for the deepseek application.
|
|
@@ -85,8 +85,8 @@ def generate_prompt_with_history(
|
|
| 85 |
# Initialize conversation
|
| 86 |
conversation = vl_chat_processor.new_chat_template()
|
| 87 |
|
| 88 |
-
if history:
|
| 89 |
-
|
| 90 |
|
| 91 |
if image is not None:
|
| 92 |
if "<image_placeholder>" not in text:
|
|
@@ -203,7 +203,7 @@ def predict(
|
|
| 203 |
text,
|
| 204 |
image,
|
| 205 |
chatbot,
|
| 206 |
-
history,
|
| 207 |
top_p,
|
| 208 |
temperature,
|
| 209 |
repetition_penalty,
|
|
@@ -244,7 +244,7 @@ def predict(
|
|
| 244 |
conversation = generate_prompt_with_history(
|
| 245 |
text,
|
| 246 |
image,
|
| 247 |
-
history,
|
| 248 |
vl_chat_processor,
|
| 249 |
tokenizer,
|
| 250 |
max_length=max_context_length_tokens,
|
|
@@ -291,7 +291,7 @@ def retry(
|
|
| 291 |
text,
|
| 292 |
image,
|
| 293 |
chatbot,
|
| 294 |
-
history,
|
| 295 |
top_p,
|
| 296 |
temperature,
|
| 297 |
repetition_penalty,
|
|
@@ -313,7 +313,7 @@ def retry(
|
|
| 313 |
text,
|
| 314 |
image,
|
| 315 |
chatbot,
|
| 316 |
-
history,
|
| 317 |
top_p,
|
| 318 |
temperature,
|
| 319 |
repetition_penalty,
|
|
@@ -452,7 +452,7 @@ def build_demo(MODELS):
|
|
| 452 |
input_text,
|
| 453 |
input_image,
|
| 454 |
chatbot,
|
| 455 |
-
history,
|
| 456 |
top_p,
|
| 457 |
temperature,
|
| 458 |
repetition_penalty,
|
|
|
|
| 62 |
|
| 63 |
|
| 64 |
def generate_prompt_with_history(
|
| 65 |
+
text, image, vl_chat_processor, tokenizer, max_length=2048
|
| 66 |
):
|
| 67 |
"""
|
| 68 |
Generate a prompt with history for the deepseek application.
|
|
|
|
| 85 |
# Initialize conversation
|
| 86 |
conversation = vl_chat_processor.new_chat_template()
|
| 87 |
|
| 88 |
+
# if history:
|
| 89 |
+
# conversation.messages = history
|
| 90 |
|
| 91 |
if image is not None:
|
| 92 |
if "<image_placeholder>" not in text:
|
|
|
|
| 203 |
text,
|
| 204 |
image,
|
| 205 |
chatbot,
|
| 206 |
+
# history,
|
| 207 |
top_p,
|
| 208 |
temperature,
|
| 209 |
repetition_penalty,
|
|
|
|
| 244 |
conversation = generate_prompt_with_history(
|
| 245 |
text,
|
| 246 |
image,
|
| 247 |
+
# history,
|
| 248 |
vl_chat_processor,
|
| 249 |
tokenizer,
|
| 250 |
max_length=max_context_length_tokens,
|
|
|
|
| 291 |
text,
|
| 292 |
image,
|
| 293 |
chatbot,
|
| 294 |
+
# history,
|
| 295 |
top_p,
|
| 296 |
temperature,
|
| 297 |
repetition_penalty,
|
|
|
|
| 313 |
text,
|
| 314 |
image,
|
| 315 |
chatbot,
|
| 316 |
+
# history,
|
| 317 |
top_p,
|
| 318 |
temperature,
|
| 319 |
repetition_penalty,
|
|
|
|
| 452 |
input_text,
|
| 453 |
input_image,
|
| 454 |
chatbot,
|
| 455 |
+
# history,
|
| 456 |
top_p,
|
| 457 |
temperature,
|
| 458 |
repetition_penalty,
|