Spaces:
Build error
Build error
Update app.py
Browse files16 unmodified lines171819202120212239 unmodified lines62636467686970716566676869707371727374757610 unmodified lines878889909192909192939495969798969910010110216 unmodified lines
HF_TOKEN = os.environ.get("HF_TOKEN", None)
TITLE = "<h1><center>Mistral-lab</center></h1>"
PLACEHOLDER = """<center><p>Chat with Mistral AI LLM.</p>39 unmodified lines print(f'history: {history}')
conversation = [] # for prompt, answer in history: # conversation.append(UserMessage(content=prompt)) # conversation.append(AssistantMessage(content=answer)) if history: conversation.extend(history) for prompt, answer in history: conversation.append(UserMessage(content=prompt)) conversation.append(AssistantMessage(content=answer)) # if history: # conversation.extend(history) conversation.append(UserMessage(content=message))
print(f'history: {conversation}') completion_request = ChatCompletionRequest(messages=conversation) tokens = tokenizer.encode_chat_completion(completion_request).tokens10 unmodified lines for i in range(len(result)): time.sleep(0.05) yield result[: i + 1] with gr.Blocks(theme="ocean", css=CSS) as demo: gr.HTML(TITLE)
chatbot = gr.Chatbot(height=600, placeholder=PLACEHOLDER)
with gr.Blocks(theme="citrus", css=CSS) as demo: gr.DuplicateButton(value="Duplicate Space for private use", elem_classes="duplicate-button") gr.ChatInterface( fn=stream_chat, title="Mistral-lab", chatbot=chatbot, type="messages", #type="messages", fill_height=True, examples=[ ["Help me study vocabulary: write a sentence for me to fill in the blank, and I'll try to pick the correct option."],app.py+15-12