Spaces:
Runtime error
Runtime error
Update app_dialogue.py
Browse files- app_dialogue.py +14 -12
app_dialogue.py
CHANGED
@@ -21,9 +21,9 @@ MODELS = [ # TODO uncomment
|
|
21 |
]
|
22 |
|
23 |
API_PATHS = { # TODO uncomment + correct endpoint
|
24 |
-
|
25 |
-
"HuggingFaceM4/idefics-9b-instruct": os.getenv("TEMP_DEPLOY_ENDPOINT"),
|
26 |
-
"HuggingFaceM4/idefics-80b-instruct": os.getenv("80B"),
|
27 |
}
|
28 |
|
29 |
SYSTEM_PROMPT = [
|
@@ -621,17 +621,19 @@ with gr.Blocks(title="IDEFICS Playground", theme=gr.themes.Base()) as demo:
|
|
621 |
text_token = text_token.lstrip()
|
622 |
|
623 |
acc_text += text_token
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
|
|
|
|
632 |
#print(f"acc_text -{acc_text} ")
|
633 |
yield "", None, chat_history
|
634 |
-
|
635 |
|
636 |
def process_example(message, image):
|
637 |
clear_msg, image_value, chat = model_inference(
|
|
|
21 |
]
|
22 |
|
23 |
API_PATHS = { # TODO uncomment + correct endpoint
|
24 |
+
"HuggingFaceM4/idefics-9b-instruct": "https://api-inference.huggingface.co/models/HuggingFaceM4/idefics-9b-instruct",
|
25 |
+
#"HuggingFaceM4/idefics-9b-instruct": os.getenv("TEMP_DEPLOY_ENDPOINT"),
|
26 |
+
#"HuggingFaceM4/idefics-80b-instruct": os.getenv("80B"),
|
27 |
}
|
28 |
|
29 |
SYSTEM_PROMPT = [
|
|
|
621 |
text_token = text_token.lstrip()
|
622 |
|
623 |
acc_text += text_token
|
624 |
+
print(f"acc_text - first - {acc_text}")
|
625 |
+
last_turn = chat_history.pop(-1)
|
626 |
+
print(f"last_turn is - {last_turn}")
|
627 |
+
last_turn[-1] += acc_text
|
628 |
+
print(f"last_turn[-1] is - {last_turn[-1]}")
|
629 |
+
if last_turn[-1].endswith("\nUser"):
|
630 |
+
last_turn[-1] = last_turn[-1][:-5]
|
631 |
+
chat_history.append(last_turn)
|
632 |
+
#chat_history[-1][-1] = acc_text
|
633 |
+
print(f"yields - chat_history -{chat_history} ")
|
634 |
#print(f"acc_text -{acc_text} ")
|
635 |
yield "", None, chat_history
|
636 |
+
acc_text = ""
|
637 |
|
638 |
def process_example(message, image):
|
639 |
clear_msg, image_value, chat = model_inference(
|