imzeeshan commited on
Commit
3b860b8
1 Parent(s): c986caf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -3
app.py CHANGED
@@ -1,7 +1,16 @@
1
  import gradio as gr
 
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
 
 
5
 
6
- demo = gr.Interface(fn=greet, inputs="text", outputs="text")
 
 
 
 
 
 
7
  demo.launch()
 
1
  import gradio as gr
2
+ from transformers import AutoTokenizer, AutoModelForCausalLM
3
 
4
+ # Load the model and tokenizer
5
+ model_name = "MoTalaat/falcon-7b-movie-recommendations"
6
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
7
+ model = AutoModelForCausalLM.from_pretrained(model_name)
8
 
9
+ def generate_recommendation(prompt):
10
+ inputs = tokenizer(prompt, return_tensors="pt")
11
+ outputs = model.generate(**inputs)
12
+ recommendation = tokenizer.decode(outputs[0], skip_special_tokens=True)
13
+ return recommendation
14
+
15
+ demo = gr.Interface(fn=generate_recommendation, inputs="text", outputs="text")
16
  demo.launch()