Spaces:
Runtime error
Runtime error
File size: 550 Bytes
47b54c6 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
from transformers import AutoTokenizer, AutoModel
import gradio as gr
tokenizer = AutoTokenizer.from_pretrained(".\\models\\chatglm-6b-int4", trust_remote_code=True, revision="")
model = AutoModel.from_pretrained(".\\models\\chatglm-6b-int4", trust_remote_code=True, revision="").half().cuda()
model = model.eval()
def chat(msg):
history = []
response, history = model.chat(tokenizer, msg, history=history)
print("response:", response)
return response
iface = gr.Interface(fn=chat, inputs="text", outputs="text")
iface.launch()
|