Spaces:
Runtime error
Runtime error
updated
Browse files
app.py
CHANGED
@@ -1,7 +1,12 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
-
|
4 |
-
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
3 |
|
4 |
+
model = AutoModelForCausalLM.from_pretrained("mlabonne/Llama-3.1-70B-Instruct-lorablated")
|
5 |
+
tokenizer = AutoTokenizer.from_pretrained("mlabonne/Llama-3.1-70B-Instruct-lorablated")
|
6 |
|
7 |
+
def generateText(prompt):
|
8 |
+
inputs = tokenizer(prompt, return_tensors="pt")
|
9 |
+
outputs = model.generate(inputs["input_ids"], max_length=100)
|
10 |
+
return tokenizer.decode(outputs[0], skip_special_tokens=True)
|
11 |
+
|
12 |
+
gr.Interface(fn=generateText, inputs="text", outputs="text").launch()
|