crumsSpace / app.py
crummei's picture
updated
a263fbd verified
raw
history blame contribute delete
542 Bytes
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()