Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,85 +1,43 @@
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
-
from sentence_transformers import SentenceTransformer, util
|
| 3 |
|
| 4 |
-
# Load
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
-
|
| 8 |
-
faq_data = {
|
| 9 |
-
"Who is SofTouch Systems?": "Derek Moyes founded SofTouch Systems in 1993 as a sole-proprietorship in San Antonio, Texas. Today, SofTouch Systems has an extensive list of customers, including home users, non-profits, and small & medium businesses.",
|
| 10 |
-
"What is SofTouch Systems?": "SofTouch Systems is a Managed Service Provider (MSP) offering IT support, cybersecurity, backups, and expert consulting for businesses and nonprofits.",
|
| 11 |
-
"What services do you offer?": "We offer managed IT services, cybersecurity, cloud consulting, server management, data backups, compliance support, and more.",
|
| 12 |
-
"Do you support remote workers?": "Yes, we offer secure remote access, VPN setup, and remote IT support for distributed teams.",
|
| 13 |
-
"How do I get help from your team?": "You can reach support via email at support@sofTouchSystems.com or by calling 1-800-555-1234.",
|
| 14 |
-
"Can you monitor our network 24/7?": "Absolutely. We offer continuous network monitoring and real-time threat alerts.",
|
| 15 |
-
"Do you provide on-site support?": "Yes, we provide both remote and on-site support depending on your business needs.",
|
| 16 |
-
"Do you offer backup and disaster recovery services?": "Yes, we offer cloud, local, and hybrid backups, plus full disaster recovery planning.",
|
| 17 |
-
"What industries do you specialize in?": "We work with small to mid-sized businesses and nonprofits, especially across Central and South Texas.",
|
| 18 |
-
"Can you help us migrate to the cloud?": "Yes, we manage cloud migrations to AWS, Azure, Google Workspace, and private cloud platforms.",
|
| 19 |
-
"Do you offer monthly service contracts?": "Yes, we offer flexible managed IT service plans based on your business size and needs.",
|
| 20 |
-
"What does a managed service provider do?": "We proactively manage and secure your IT systems so you can focus on running your business.",
|
| 21 |
-
"Do you offer cybersecurity assessments?": "Yes, we offer comprehensive cybersecurity audits and recommendations for improvement.",
|
| 22 |
-
"Can you manage our email systems?": "Yes, we provide secure and reliable email hosting and management services.",
|
| 23 |
-
"How often do you perform updates and patches?": "We patch systems regularly, usually weekly, and critical updates are handled immediately.",
|
| 24 |
-
"What is your response time for emergencies?": "We respond to emergencies within 1 hour, and most issues are resolved same-day.",
|
| 25 |
-
"Can you support Apple/Mac devices?": "Yes, we support both Windows and Apple environments.",
|
| 26 |
-
"Do you manage printers and other devices?": "Yes, we can manage printers, scanners, and other networked devices.",
|
| 27 |
-
"Do you offer firewall setup and management?": "Yes, we install and manage business-grade firewalls and advanced threat protection.",
|
| 28 |
-
"Can you help with password management?": "Yes, we offer password policy enforcement and integrate password manager solutions.",
|
| 29 |
-
"How do you protect against ransomware?": "We use endpoint protection, backup redundancy, and real-time threat detection.",
|
| 30 |
-
"What happens if our internet goes down?": "We help you set up failover connections and local network resilience options.",
|
| 31 |
-
"Do you help with IT compliance?": "Yes, we support HIPAA, PCI-DSS, and general IT compliance frameworks.",
|
| 32 |
-
"Can you set up Microsoft 365 or Google Workspace?": "Yes, we offer licensing, setup, migration, and management for both platforms.",
|
| 33 |
-
"How do I request a service call?": "You can email, call, or use our customer portal to request service anytime.",
|
| 34 |
-
"Do you offer antivirus software?": "Yes, we provide managed antivirus and endpoint protection as part of our packages.",
|
| 35 |
-
"Can you help us reduce IT costs?": "Yes, we optimize systems and consolidate services to cut unnecessary expenses.",
|
| 36 |
-
"Do you help with technology planning?": "Absolutely. We provide long-term IT roadmapping and infrastructure planning.",
|
| 37 |
-
"What is the onboarding process like?": "We do a full audit, deploy monitoring tools, and start support within 1–2 weeks.",
|
| 38 |
-
"Do you offer data encryption?": "Yes, we implement encryption for devices, cloud storage, and data in transit.",
|
| 39 |
-
"Can we keep our current hardware?": "Yes, we assess your equipment and integrate it where possible to save costs.",
|
| 40 |
-
"What makes you different from other MSPs?": "We're veteran-owned, Texas-based, and known for fast response and friendly service.",
|
| 41 |
-
"Do you train employees on cybersecurity?": "Yes, we offer phishing simulations and security awareness training.",
|
| 42 |
-
"What’s included in your managed services?": "Monitoring, help desk, patches, backups, security, and strategic advice.",
|
| 43 |
-
"Can you integrate third-party apps or CRMs?": "Yes, we work with CRMs, ERPs, and other business platforms.",
|
| 44 |
-
"Do you offer VoIP phone system support?": "Yes, we can help with VoIP setup, support, and vendor coordination.",
|
| 45 |
-
"Can you help us set up secure remote desktop access?": "Yes, we use tools like RDP over VPN and encrypted remote agents.",
|
| 46 |
-
"Do you offer documentation for our systems?": "Yes, we provide IT documentation so you always know what’s in place.",
|
| 47 |
-
"What kind of reports will I get?": "You’ll receive monthly reports on uptime, patches, security events, and more.",
|
| 48 |
-
"Is there a contract required?": "We offer both contract and no-contract month-to-month options.",
|
| 49 |
-
"How fast can we get started?": "We can start with a discovery call immediately and usually onboard within 5–10 business days.",
|
| 50 |
-
"Do you offer IT strategy consulting?": "Yes, we help align your tech decisions with your business goals.",
|
| 51 |
-
"Can you help with business continuity planning?": "Absolutely. We create BCPs tailored to your specific risk profile.",
|
| 52 |
-
"Do you offer mobile device management?": "Yes, we secure and monitor business smartphones, tablets, and laptops.",
|
| 53 |
-
"What’s your pricing structure like?": "We offer fixed monthly pricing, tiered service plans, and pay-as-you-go support.",
|
| 54 |
-
"Do you work with nonprofits?": "Yes, we serve many nonprofits and offer discounted rates for 501(c)(3) organizations.",
|
| 55 |
-
"Do you help with internet setup?": "Yes, we assist with ISP selection, router/firewall setup, and cabling.",
|
| 56 |
-
"Can you help us prevent phishing attacks?": "Yes, we use anti-phishing tools, filtering, and user training.",
|
| 57 |
-
"Will we have a dedicated point of contact?": "Yes, every client gets an account manager and dedicated tech lead.",
|
| 58 |
-
"Do you support cloud storage?": "Yes, we manage OneDrive, Google Drive, Dropbox, and other cloud platforms.",
|
| 59 |
-
"How do you back up email?": "We provide email archiving, daily backups, and retention policy management."
|
| 60 |
-
}
|
| 61 |
|
| 62 |
-
#
|
| 63 |
-
|
| 64 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
|
| 66 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
|
| 68 |
-
|
| 69 |
-
# Convert input to lowercase for better matching
|
| 70 |
-
user_input = message.lower()
|
| 71 |
-
|
| 72 |
-
# Extract the list of questions
|
| 73 |
-
questions = list(faq_data.keys())
|
| 74 |
-
|
| 75 |
-
# Use difflib to find closest match
|
| 76 |
-
closest_match = difflib.get_close_matches(user_input, questions, n=1, cutoff=0.5)
|
| 77 |
|
| 78 |
-
if closest_match:
|
| 79 |
-
matched_question = closest_match[0]
|
| 80 |
-
return faq_data[matched_question]
|
| 81 |
-
else:
|
| 82 |
-
return "I'm still learning. Try asking about our services, support, cybersecurity, or backups."
|
| 83 |
|
| 84 |
iface = gr.ChatInterface(
|
| 85 |
fn=chatbot,
|
|
|
|
| 1 |
+
import csv
|
| 2 |
+
from rapidfuzz import process
|
| 3 |
import gradio as gr
|
|
|
|
| 4 |
|
| 5 |
+
# Load FAQ from CSV
|
| 6 |
+
def load_faq_csv(filepath='faq.csv'):
|
| 7 |
+
qa_dict = {}
|
| 8 |
+
with open(filepath, newline='', encoding='utf-8') as csvfile:
|
| 9 |
+
reader = csv.DictReader(csvfile)
|
| 10 |
+
for row in reader:
|
| 11 |
+
question = row['question'].strip()
|
| 12 |
+
answer = row['answer'].strip()
|
| 13 |
+
qa_dict[question] = answer
|
| 14 |
+
return qa_dict
|
| 15 |
|
| 16 |
+
qa_pairs = load_faq_csv()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
+
# Fuzzy match logic
|
| 19 |
+
def get_answer(user_input):
|
| 20 |
+
match, score = process.extractOne(user_input, qa_pairs.keys())
|
| 21 |
+
if score > 80:
|
| 22 |
+
return qa_pairs[match]
|
| 23 |
+
else:
|
| 24 |
+
return "I'm not sure about that. Please reach out to support@softouchsystems.com for assistance."
|
| 25 |
+
|
| 26 |
+
# Gradio interface
|
| 27 |
+
def chatbot_interface(message):
|
| 28 |
+
return get_answer(message)
|
| 29 |
|
| 30 |
+
iface = gr.Interface(
|
| 31 |
+
fn=chatbot_interface,
|
| 32 |
+
inputs="text",
|
| 33 |
+
outputs="text",
|
| 34 |
+
title="SofBot - Ask Us Anything",
|
| 35 |
+
description="Get quick answers about SofTouch Systems' services and support.",
|
| 36 |
+
theme="default"
|
| 37 |
+
)
|
| 38 |
|
| 39 |
+
iface.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
iface = gr.ChatInterface(
|
| 43 |
fn=chatbot,
|