|
import gradio as gr |
|
|
|
|
|
interface = gr.load("models/mistralai/Mixtral-8x7B-Instruct-v0.1") |
|
|
|
|
|
DEFAULT_SYSTEM_PROMPT = """ |
|
You are a helpful assistant in normal conversation. |
|
When given a problem to solve, you are an expert problem-solving assistant. |
|
Your task is to provide a detailed, step-by-step solution to a given question. |
|
""" |
|
|
|
|
|
def clear_chat(): |
|
return [], "" |
|
|
|
|
|
with gr.Blocks() as demo: |
|
gr.Markdown("# Custom Chat Interface") |
|
|
|
with gr.Row(): |
|
model_dropdown = gr.Dropdown(choices=["Mixtral-8x7B-Instruct-v0.1"], label="Select Model", value="Mixtral-8x7B-Instruct-v0.1") |
|
|
|
system_prompt = gr.Textbox(value=DEFAULT_SYSTEM_PROMPT, lines=5, label="System Prompt") |
|
chatbot = gr.Chatbot(label="Chat") |
|
msg = gr.Textbox(label="Type your message here...", placeholder="Enter your message...") |
|
|
|
msg.submit(interface, inputs=[msg, chatbot, model_dropdown, system_prompt], outputs=[chatbot, msg]) |
|
gr.Button("Clear Chat").click(clear_chat, inputs=None, outputs=[chatbot, msg]) |
|
|
|
demo.launch() |
|
|