Nebula / app.py
SaintZion's picture
Create app.py
d460722 verified
Raw History Blame Contribute Delete
5.39 kB
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()