Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,16 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
-
|
4 |
-
|
|
|
|
|
5 |
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
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()
|