Spaces:
Runtime error
Runtime error
File size: 1,086 Bytes
ca838f6 99fc69e cf058f4 942ae7e ca838f6 cf058f4 ca838f6 c07b63c ca838f6 e228c01 c07b63c ca838f6 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
import gradio as gr
from transformers import AutoTokenizer
from petals import AutoDistributedModelForCausalLM
import npc_data
# Choose any model available at https://health.petals.dev
model_name = "daekeun-ml/Llama-2-ko-instruct-13B"
#daekeun-ml/Llama-2-ko-instruct-13B
#quantumaikr/llama-2-70b-fb16-korean
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoDistributedModelForCausalLM.from_pretrained(model_name)
# Run the model as if it were on your computer
def chat2(id, npc, text):
prom = ""
inputs = tokenizer(prom, return_tensors="pt")["input_ids"]
outputs = model.generate(inputs, max_new_tokens=100)
print(tokenizer.decode(outputs[0]))
return text
def chat(id, npc, text):
return f"{text}μ λν {npc}μ μλ΅"
with gr.Blocks() as demo:
count = 0
aa = gr.Interface(
fn=chat,
inputs=["text","text","text"],
outputs="text",
description="chat, ai μλ΅μ λ°νν©λλ€. λ΄λΆμ μΌλ‘ νΈλμμ
μμ±. \n /run/predict",
)
demo.queue(max_size=32).launch(enable_queue=True) |