File size: 648 Bytes
b04a659
 
3538aac
 
 
e72c8c4
 
3538aac
e72c8c4
3538aac
e72c8c4
 
3538aac
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import gradio as gr

model = gr.load("models/mistralai/Mixtral-8x7B-Instruct-v0.1")

def chat(prompt, response_type):
    response = model(prompt)
    max_tokens = 200
    if response_type == "Short":
        max_tokens = 50
    elif response_type == "Medium":
        max_tokens = 100
    return response[:max_tokens]

demo = gr.Interface(
    fn=chat,
    inputs=[
        gr.Textbox(label="Prompt"),
        gr.Radio(["Short", "Medium", "Long"], label="Response Type")
    ],
    outputs=gr.Textbox(label="Response"),
    title="Mixtral-8x7B-Instruct-v0.1 Chat",
    description="Chat with the Mixtral-8x7B-Instruct-v0.1 model."
)

demo.launch()