Spaces:
Runtime error
Runtime error
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() | |