| import gradio as gr | |
| from transformers import pipeline | |
| def generate_ticket(issue_description): | |
| model_name = "AventIQ-AI/bart_customer_ticket_raiser" | |
| generator = pipeline("text2text-generation", model=model_name) | |
| response = generator(issue_description, max_length=50, num_return_sequences=1) | |
| return response[0]['generated_text'] | |
| examples = [ | |
| ["My internet is not working for the past 3 hours."], | |
| ["I am unable to log in to my account despite entering the correct credentials."], | |
| ["The mobile app keeps crashing whenever I try to make a payment."], | |
| ["I received a defective product and need a replacement."] | |
| ] | |
| with gr.Blocks(theme=gr.themes.Soft()) as demo: | |
| gr.Markdown("# π© Customer Ticket Generator") | |
| gr.Markdown("Enter a customer issue, and the model will generate a structured support ticket.") | |
| with gr.Row(): | |
| input_text = gr.Textbox(label="Customer Issue Description", placeholder="Describe your issue here...", lines=3) | |
| generate_btn = gr.Button("Generate Ticket π") | |
| output_text = gr.Textbox(label="Generated Support Ticket") | |
| generate_btn.click(generate_ticket, inputs=[input_text], outputs=[output_text]) | |
| gr.Examples(examples, inputs=[input_text]) | |
| demo.launch() |