File size: 5,385 Bytes
d460722 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | import gradio as gr
# Define our services and pricing
SERVICES = {
"websites": {
"Business": {
"price": "R600/month",
"features": [
"Professional Single Website",
"Basic SEO Setup",
"Contact form integration",
"1 Revision Round",
"1GB hosting included"
]
},
"Business Pro": {
"price": "R660/month",
"features": [
"Professional 4-5 Page Website",
"Enhanced SEO Setup & Analytics",
"Social media integration",
"2 Revision Rounds",
"Analytics setup"
]
},
"E-Commerce": {
"price": "R760/month",
"features": [
"Product catalogue",
"Payment gateway integration",
"Inventory management",
"Product reviews system",
"Advanced security features"
]
}
},
"social_media": {
"1-5 posts": "R450/post",
"6-10 posts": "R425/post",
"11+ posts": "R400/post"
},
"branding": {
"Basic": {
"price": "R1,200",
"features": [
"Business cards (Digital Included)",
"Letterhead",
"Email signature"
]
},
"Standard": {
"price": "R1,800",
"features": [
"All Basic package features",
"Social media templates",
"Presentation template"
]
},
"Premium": {
"price": "R2,500",
"features": [
"All Standard package features",
"Marketing collateral",
"Brand guidelines"
]
}
},
"logo": {
"price": "R850",
"features": [
"2 concept designs",
"3 revision rounds",
"Multiple file formats"
]
}
}
def get_service_info(service_type, package=None):
if service_type not in SERVICES:
return "I'm not sure about that service. Would you like to know about our websites, social media, branding, or logo design services?"
service = SERVICES[service_type]
if package and isinstance(service, dict) and package in service:
package_info = service[package]
features = "\n".join(f"- {feature}" for feature in package_info['features'])
return f"{package} Package - {package_info['price']}\n\nFeatures:\n{features}"
if isinstance(service, dict):
return "\n".join(f"{key}: {value['price']}" for key, value in service.items())
return service
def respond(message, history):
message = message.lower()
# Check for greetings
if any(word in message for word in ['hello', 'hi', 'hey']):
return "Hello! I'm the Malfactor Labs AI assistant. How can I help you with your digital presence today? I can provide information about our website packages, social media management, branding services, or logo design."
# Check for pricing inquiries
if 'price' in message or 'cost' in message or 'pricing' in message:
if 'website' in message:
return "Our website packages are:\n" + get_service_info('websites')
if 'social' in message or 'post' in message:
return "Our social media management pricing:\n" + get_service_info('social_media')
if 'brand' in message:
return "Our branding packages are:\n" + get_service_info('branding')
if 'logo' in message:
return get_service_info('logo', None)
return "Which service would you like pricing for? We offer website development, social media management, branding services, and logo design."
# Check for package-specific inquiries
if 'business' in message and 'pro' in message:
return get_service_info('websites', 'Business Pro')
if 'business' in message:
return get_service_info('websites', 'Business')
if 'ecommerce' in message or 'e-commerce' in message:
return get_service_info('websites', 'E-Commerce')
# Check for consultation requests
if 'consult' in message or 'book' in message or 'appointment' in message:
return "I'd be happy to help you schedule a consultation. Could you please provide:\n1. Your business name\n2. Contact person's name\n3. Email address\n4. Phone number\n\nOnce you provide these details, I can help schedule a time that works for you."
# Default response
return "I'm here to help! Would you like to know about our:\n- Website packages\n- Social media management\n- Branding services\n- Logo design\n\nOr would you like to schedule a consultation?"
# Create the Gradio interface
demo = gr.ChatInterface(
fn=respond,
title="Malfactor Labs Digital Assistant",
description="Ask me about our digital services, pricing, or schedule a consultation!",
examples=[
"What are your website packages?",
"How much does social media management cost?",
"Tell me about your branding services",
"I need a logo design",
"I'd like to schedule a consultation"
],
theme=gr.themes.Soft(
primary_hue="blue",
secondary_hue="gray",
)
)
demo.launch() |