Thebull commited on
Commit
73d93e2
1 Parent(s): 5ae1910

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -5
app.py CHANGED
@@ -1,7 +1,12 @@
1
- import gradio as gr
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
5
 
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- iface.launch()
 
 
 
 
 
 
1
+ from transformers import AutoModelForCausalLM, AutoTokenizer
2
 
3
+ model_id = "mistralai/Mixtral-8x7B-Instruct-v0.1"
4
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
5
 
6
+ model = AutoModelForCausalLM.from_pretrained(model_id)
7
+
8
+ text = "Hello my name is"
9
+ inputs = tokenizer(text, return_tensors="pt")
10
+
11
+ outputs = model.generate(**inputs, max_new_tokens=20)
12
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))