import gradio as gr from transformers import AutoTokenizer, AutoModelForCausalLM # Load the model and tokenizer model_name = "MoTalaat/falcon-7b-movie-recommendations" tokenizer = AutoTokenizer.from_pretrained(model_name) model = AutoModelForCausalLM.from_pretrained(model_name) def generate_recommendation(prompt): inputs = tokenizer(prompt, return_tensors="pt") outputs = model.generate(**inputs) recommendation = tokenizer.decode(outputs[0], skip_special_tokens=True) return recommendation demo = gr.Interface(fn=generate_recommendation, inputs="text", outputs="text") demo.launch()