Spaces:
Runtime error
Runtime error
dimitris
commited on
Commit
·
b9973b4
1
Parent(s):
dcacc9e
Add application file
Browse files- .requirements.txt.un~ +0 -0
- app.py +18 -0
- requirements.txt +5 -0
.requirements.txt.un~
ADDED
Binary file (523 Bytes). View file
|
|
app.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import torch
|
3 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
4 |
+
|
5 |
+
model_id = "mistralai/Mixtral-8x7B-v0.1"
|
6 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
7 |
+
model = AutoModelForCausalLM.from_pretrained(model_id, load_in_8bit=False)
|
8 |
+
|
9 |
+
|
10 |
+
def greet(text):
|
11 |
+
# text = "Hello my name is"
|
12 |
+
inputs = tokenizer(text, return_tensors="pt").to(0)
|
13 |
+
outputs = model.generate(**inputs, max_new_tokens=20)
|
14 |
+
return tokenizer.decode(outputs[0], skip_special_tokens=True)
|
15 |
+
|
16 |
+
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
17 |
+
iface.launch()
|
18 |
+
|
requirements.txt
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
transformers
|
2 |
+
-i https://download.pytorch.org/whl/cpu
|
3 |
+
torch
|
4 |
+
bitsandbytes
|
5 |
+
|