crummei commited on
Commit
a263fbd
1 Parent(s): 7bcffef
Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -1,7 +1,12 @@
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 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()