imzeeshan's picture
Update app.py
3b860b8 verified
raw
history blame contribute delete
605 Bytes
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()