File size: 656 Bytes
ac75963
7bf4786
ac75963
7bf4786
 
 
 
ac75963
7bf4786
 
 
 
 
ac75963
7bf4786
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import gradio as gr
from transformers import AutoModelForCausalLM, AutoTokenizer

# Replace 'your-username/your-model' with your model's name
model_name = "Atchayaa13/mistral-7b-oig-unsloth-merged"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name)

def chatbot_response(message):
    inputs = tokenizer(message, return_tensors="pt")
    outputs = model.generate(inputs.input_ids, max_length=100)
    response = tokenizer.decode(outputs[0], skip_special_tokens=True)
    return response

iface = gr.Interface(fn=chatbot_response, inputs="text", outputs="text", title="My Chatbot")
iface.launch()