Update app.py
Browse files1238 unmodified lines12131415161722 unmodified lines404142from transformers import AutoProcessor, AutoModelForCausalLMprint("Hello1")8 unmodified lines)print("Hello2")# Promptmessages = [{"role": "system", "content": "You are a helpful assistant."},22 unmodified linesprint(result)while True:pass12348 unmodified lines1314151617181922 unmodified lines4243444546474849505152535455565758import gradio as grfrom transformers import AutoProcessor, AutoModelForCausalLMprint("Hello1")8 unmodified lines)print("Hello2")'''# Promptmessages = [{"role": "system", "content": "You are a helpful assistant."},22 unmodified linesprint(result)while True:pass'''def predict(message, history):messages = history + [{"role":"user","content":message}]input_text = processor.apply_chat_template(messages,tokenize=False,add_generation_prompt=True,enable_thinking=False)inputs = processor(text=text, return_tensors="pt").to(model.device)outputs = model.generate(**inputs, max_new_tokens=1024)response = processor.decode(outputs[0][input_len:], skip_special_tokens=False)print("Hello3")return responsedemo = gr.ChatInterface(predict, api_name="chat")demo.launch()
app.py+16