import gradio as gr from transformers import AutoModelForCausalLM, AutoTokenizer import torch # Load the model and tokenizer model_name = "kainatq/Kainoverse-7b-v0.1" tokenizer = AutoTokenizer.from_pretrained(model_name) model = AutoModelForCausalLM.from_pretrained(model_name) def generate_response(user_input): inputs = tokenizer.encode(user_input, return_tensors='pt') outputs = model.generate(inputs, max_length=1000, num_return_sequences=1) response = tokenizer.decode(outputs[0], skip_special_tokens=True) return response # Create Gradio interface iface = gr.Interface(fn=generate_response, inputs="text", outputs="text", title="Kainoverse Chatbot") iface.launch()