Upload 2 files
Browse files- app.py +31 -0
- requirements.txt +8 -0
app.py
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
def generate_ticket(issue_description):
|
| 5 |
+
model_name = "AventIQ-AI/bart_customer_ticket_raiser"
|
| 6 |
+
generator = pipeline("text2text-generation", model=model_name)
|
| 7 |
+
response = generator(issue_description, max_length=50, num_return_sequences=1)
|
| 8 |
+
return response[0]['generated_text']
|
| 9 |
+
|
| 10 |
+
examples = [
|
| 11 |
+
["My internet is not working for the past 3 hours."],
|
| 12 |
+
["I am unable to log in to my account despite entering the correct credentials."],
|
| 13 |
+
["The mobile app keeps crashing whenever I try to make a payment."],
|
| 14 |
+
["I received a defective product and need a replacement."]
|
| 15 |
+
]
|
| 16 |
+
|
| 17 |
+
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
| 18 |
+
gr.Markdown("# 📩 Customer Ticket Generator")
|
| 19 |
+
gr.Markdown("Enter a customer issue, and the model will generate a structured support ticket.")
|
| 20 |
+
|
| 21 |
+
with gr.Row():
|
| 22 |
+
input_text = gr.Textbox(label="Customer Issue Description", placeholder="Describe your issue here...", lines=3)
|
| 23 |
+
|
| 24 |
+
generate_btn = gr.Button("Generate Ticket 📝")
|
| 25 |
+
output_text = gr.Textbox(label="Generated Support Ticket")
|
| 26 |
+
|
| 27 |
+
generate_btn.click(generate_ticket, inputs=[input_text], outputs=[output_text])
|
| 28 |
+
|
| 29 |
+
gr.Examples(examples, inputs=[input_text])
|
| 30 |
+
|
| 31 |
+
demo.launch()
|
requirements.txt
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
torch
|
| 2 |
+
transformers
|
| 3 |
+
gradio
|
| 4 |
+
sentencepiece
|
| 5 |
+
torchvision
|
| 6 |
+
huggingface_hub
|
| 7 |
+
pillow
|
| 8 |
+
numpy
|