Ai Medical Rep Chatbot

The AI Medical Rep Chatbot is a cutting-edge digital assistant designed to support healthcare professionals (HCPs) by providing accurate and detailed information about a company’s medical products. Acting as a virtual medical representative, it delivers an interactive and user-friendly experience to address queries, explain product details, and enhance HCP engagement with real-time voice and avatar integration.

The solution has been crafted for global clients such as Novartis, Merck, and other leading pharmaceutical companies, aiming to enhance product education and streamline communication with HCPs. To provide a reliable, interactive, and AI-powered platform that empowers HCPs with real-time access to product knowledge, fostering informed decision-making and improved patient care.

Next.js code available in Github.

Features

  • Comprehensive Q&A Support: Provides instant, accurate responses to all product-related questions and queries. Offers detailed explanations regarding product use, benefits, and guidelines.
  • Real-time Voice & Avatar Interaction: Lifelike voice interactions for a conversational experience.
  • Advanced Technology Stack: Frontend: Built using Next.js for a seamless, responsive, and modern user interface. Backend: Powered by Python and Node.js, ensuring scalability, high performance, and robust AI-driven query handling.
  • Global Adaptability: Tailored to meet the diverse needs of global pharmaceutical clients.
Screenshots:

Audio Generation Example

1. Flask-Based Audio Generation Service with gTTS
  • Text-to-Speech Conversion: Transforms chatbot responses into clear and natural-sounding audio.
  • Seamless Integration: Designed to integrate effortlessly with the chatbot's real-time voice interaction feature.
  • Multilingual Support: Generates audio in multiple languages to cater to a global audience.
  • Efficient API Service: Exposes endpoints for on-demand audio generation, ensuring fast and reliable performance.
from flask import Flask, request, jsonify, send_file
from flask_cors import CORS
from gtts import gTTS
import os
import uuid
app = Flask(__name__)
# Enable CORS
CORS(app, resources={r"/*": {"origins": "http://localhost:3000"}}) # Replace with your frontend URL
# Directory to save audio files
AUDIO_DIR = 'audio'
if not os.path.exists(AUDIO_DIR):
os.makedirs(AUDIO_DIR)
@app.route('/talk', methods=['POST'])
def talk():
data = request.json
text = data['text']
v4_uuid = uuid.uuid4()
# Generate speech using gTTS
audio_file_path = os.path.join(AUDIO_DIR, "{}.mp3".format(v4_uuid) )
tts = gTTS(text=text, lang='en')
tts.save(audio_file_path)
return jsonify({"audio_url": "http://127.0.0.1:5000/audio/{}.mp3".format(v4_uuid)})
# Serve the generated audio file
@app.route('/audio/<filename>')
def serve_audio(filename):
return send_file(os.path.join(AUDIO_DIR, filename), as_attachment=True)
if __name__ == '__main__':
app.run(debug=True, port=5000)
This backend application, built with Python Flask, serves as the audio generation engine for the AI Medical Rep Chatbot. Leveraging the Google Text-to-Speech (gTTS) library, it dynamically converts text-based product information and responses into high-quality audio files.