File size: 661 Bytes
910cd9d 443ac6c 29adc5c 910cd9d 407d8de 443ac6c 910cd9d 407d8de 3c9499e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | import gradio as gr
from transformers import pipeline
generator = pipeline("text-generation", model="Qwen/Qwen2.5-0.5B-Instruct", device=-1)
def respond(message):
messages = [
{"role": "system", "content": "You are a business negotiation agent. Be direct, strategic, and professional."},
{"role": "user", "content": message},
]
result = generator(messages, max_new_tokens=256, do_sample=True, temperature=0.7)
return result[0]["generated_text"][-1]["content"]
demo = gr.Interface(
fn=respond,
inputs=gr.Textbox(label="Message"),
outputs=gr.Textbox(label="Response"),
title="Negotiation Agent",
)
demo.launch() |