
Back
Sales, Lead Gen & Outreach
A Real-Time Sentiment Classifier With Built-In Lead Capture for Social-Listening Evaluation
How Pfactorial Technologies built a BERT-based sentiment classifier that scores text in real time while capturing structured interest data from every visitor who tries it.
August 21, 2026
Share
ENGAGEMENT SNAPSHOT

Figure 1 - Key figures from this engagement, at a glance.
EXECUTIVE SUMMARY
Our client needed a fast, working way to demonstrate a sentiment-analysis capability against real text, and - just as important - to capture structured interest from every visitor who tried it, without standing up a full machine-learning pipeline first.
Training a bespoke classifier wasn't justified before commercial interest was confirmed, and a bare technical demo with no capture path would have wasted the exact traffic it was built to attract; what was needed was a real, usable tool that could be shown to prospects today, not a notebook.
Pfactorial built a Flask application that wraps a pre-trained BERT tweet-sentiment model behind a simple form and API, returning real-time positive, negative, or neutral feedback while logging every submission's contact and project details to a durable record.
Why this engagement is representative This engagement demonstrates Pfactorial's ability to turn a pre-trained model integration into a working evaluation tool that doubles as a lead-capture instrument, not just a technical demo.
THE CHALLENGE
Building an evaluation-stage tool meant solving for speed to market and lead capture, not just model accuracy.
1. Evaluating sentiment analysis without months of model training
Training or fine-tuning a bespoke classifier wasn't justified before commercial interest was confirmed, so the tool had to reuse an existing, purpose-fit model correctly rather than build one from scratch.
2. The demo has to double as a way to capture real interest
Every visitor who tried the tool needed to become a qualified lead, so the flow had to capture and store contact and project information for follow-up, not just show a result and move on.
3. An external inference API sits in the critical path
Sentiment scoring depends on a third-party model host reachable over the network, so every submission's latency and availability are partly outside the application's own control.
4. One form has to serve two different jobs cleanly
The same submission needed to run inference, return sentiment feedback, and log the submitter's details, without the two concerns tangling together or one failure taking down the other.
The real brief Not "wire a chatbot to a sentiment model" but "make a working, real-time evaluation tool that both proves the capability and records every visitor who wanted to see it."
THE SOLUTION
Pfactorial built a Flask application that pairs a pre-trained BERT sentiment model with a structured lead-capture flow in the same request handler.

Figure 1 - Inference and lead capture run from the same request but write to independent stores, so one cannot break the other.
Architectural principles
- Reuse, don't retrain - A pre-trained, purpose-built tweet-sentiment model let the tool ship before any commercial commitment was made to owning a model-training pipeline.
- Two concerns, one request, cleanly separated - Inference and lead logging run from the same POST handler but write to independent stores, so a logging hiccup can't break the sentiment result a visitor sees.
- Default to a safe empty state - An empty submission returns a defined neutral response rather than an error, so the UI never breaks on the most common accidental input.
CAPABILITIES DELIVERED
Each capability is aimed at making the evaluation tool both convincing to try and useful to have run.
CAPABILITY | WHAT IT DOES |
|---|---|
Real-time sentiment scoring | A visitor submits any text and receives an instant positive, negative, or neutral read. |
Pre-trained model integration | A Hugging Face BERT tweet-sentiment model is called via API, with no training or fine-tuning pipeline required. |
Structured lead capture | Every submission records first name, last name, company, email, and project details. |
CSV-based lead log | Submissions accumulate in a durable CSV file for follow-up and analysis, with no database required at this stage. |
Graceful empty-input handling | Blank text returns a defined neutral response instead of an error. |

Figure 2 - Every visitor who tries the classifier leaves behind both a result and a record.
Design note Depending on an external inference API for a user-facing, real-time result is a deliberate trade-off - it avoided provisioning and hosting model-serving infrastructure for an evaluation-stage tool, at the cost of the app's latency and uptime being partly gated by a third party.
ENGINEERING FOR SCALE AND RELIABILITY
Four decisions kept the evaluation tool honest about its scope while still holding up under real visitor traffic.
A pre-trained inference API instead of a self-hosted model
Calling a hosted BERT model let the tool ship without provisioning inference infrastructure, at a stage where commercial interest - not model ownership - was the open question.
CSV logging instead of a database
A flat file was enough for the volume and audience of an evaluation-stage tool, and keeps every captured lead readable without a query layer.
A defined neutral default for empty input
Rather than letting an empty string reach the model, the app returns a fixed neutral response, so the classifier can't error on the most common accidental submission.
Inference and lead capture kept as separate steps in one handler
The POST route calls the sentiment function and the CSV write independently, so a failure in one path doesn't take down the other.
DELIVERY APPROACH
The build moved from model integration outward to the lead-capture flow that makes the demo commercially useful.
1. Model selection & integration - evaluating and wiring in a pre-trained BERT tweet-sentiment model via Hugging Face's inference API.
2. Form & request handling - building the Flask routes for GET (form render) and POST (text submission plus contact and project fields).
3. Sentiment logic - implementing the sentiment-check function with a defined empty-input fallback and API response parsing into positive, negative, and neutral probabilities.
4. Lead logging - wiring CSV logging of every submission's contact and project details for follow-up.
5. UI feedback - rendering the sentiment result back to the visitor in the same page render, so an evaluator sees the classification immediately.
RESULTS AND IMPACT

- Key outcomes from this engagement.
The classifier scores submitted text as positive, negative, or neutral in real time using a pre-trained model, and every submission - the text plus the visitor's name, company, email, and project details - is captured to a durable log, without requiring a custom model-training investment upfront.
Because inference and lead capture are kept as separate steps in the same request handler, a lag or hiccup in the third-party model host affects only the sentiment result shown, not the record of who tried the tool and why.
What it enabled commercially
The client can now show the sentiment-analysis capability to prospects directly, and every person who tries it becomes a captured, follow-up-ready lead - turning a technical demo into a source of qualified interest before any commitment to a larger build.
WHY PFACTORIAL
This engagement reflects Pfactorial's ability to turn a pre-trained model into a working, evaluation-ready tool quickly - integrating third-party AI capability into a real product flow rather than a standalone notebook, with lead capture built in from day one.

- Service lines this engagement draws on.
Engagement enquiries Pfactorial Technologies works with organisations that need to prove out an AI capability quickly and capture the interest it generates along the way. If you're evaluating a social-listening or text-analysis product, we're happy to give you an honest read on scope and risk before anyone commits to anything. · pfactorial.ai
APPENDIX A - TECHNOLOGY STACK
The technology stack underpinning the system, grouped by the layer it serves.

Result and Analysis
ENGAGEMENT SNAPSHOT
How Pfactorial Technologies built a BERT-based sentiment classifier that scores text in real time while capturing structured interest data from every visitor who tries it.
CASE STUDIES
You might also like...

ML Infra, Classifiers & RL
Aug 21, 20266 min readRead

Automotive & Vehicle
A Browser-Native Neural Network Simulation That Learns to Drive From Experience
Aug 21, 20267 min readRead

Computer VisionML Infra, Classifiers & RL
A Deep Learning Classifier That Separates True-Negative Mammograms from Genuine BIRADS 0 Cases
Aug 21, 20266 min readRead

Conversational AI & ChatbotsML Infra, Classifiers & RL
A Layered Safety Pipeline for a Healthcare Patient Companion
Aug 21, 20268 min readRead

ML Infra, Classifiers & RL
A Machine-Learning Screening Model for Pulmonary Hypertension from Routine Medical Records
Aug 21, 20266 min readRead

Sales, Lead Gen & OutreachMulti-Agent & Agentic Systems
A Personalized AI Avatar Video Platform for Outreach at Scale
Aug 21, 20266 min readRead





