File size: 542 Bytes
7bcffef
a263fbd
7bcffef
a263fbd
 
7bcffef
a263fbd
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
import gradio as gr
from transformers import AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained("mlabonne/Llama-3.1-70B-Instruct-lorablated")
tokenizer = AutoTokenizer.from_pretrained("mlabonne/Llama-3.1-70B-Instruct-lorablated")

def generateText(prompt):
    inputs = tokenizer(prompt, return_tensors="pt")
    outputs = model.generate(inputs["input_ids"], max_length=100)
    return tokenizer.decode(outputs[0], skip_special_tokens=True)

gr.Interface(fn=generateText, inputs="text", outputs="text").launch()