Add tiered summarization based on pricing plans
- Implement advanced AI summarization with action items for Pro plan - Create basic bullet-point summarization for Freemium plan - Add plan tier validation and feature differentiation - Support speaker identification in transcripts - Define plan limits (600 mins Pro/200 mins Freemium)
This commit is contained in:
@@ -0,0 +1,90 @@
|
||||
import os
|
||||
import requests
|
||||
import json
|
||||
from dotenv import load_dotenv
|
||||
load_dotenv()
|
||||
|
||||
# API endpoint
|
||||
base_url = "http://localhost:5056"
|
||||
|
||||
# Your API key
|
||||
api_key = os.getenv("API_KEY_ACCESS")
|
||||
|
||||
# Headers
|
||||
headers = {
|
||||
"Authorization": f"Bearer {api_key}",
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
|
||||
# Audio URL for testing
|
||||
audio_url = "https://s3.us-east-2.amazonaws.com/com.mkdlabs.images/baas/jordan/019933724441Business%20English%20Conversation%20Lesson%2045_%20Meeting%20a%20New%20Colleague.mp3"
|
||||
|
||||
# Test function to compare freemium and pro plan transcriptions
|
||||
def test_plan_differences():
|
||||
# 1. Test the freemium plan (no speaker identification)
|
||||
freemium_payload = {
|
||||
"media_url": audio_url,
|
||||
"media_type": "audio",
|
||||
"plan_tier": "freemium"
|
||||
}
|
||||
|
||||
print("Testing Freemium Plan (no speaker identification)...")
|
||||
freemium_response = requests.post(
|
||||
f"{base_url}/microdot-ai/transcribe",
|
||||
headers=headers,
|
||||
json=freemium_payload
|
||||
)
|
||||
|
||||
# 2. Test the pro plan (with speaker identification)
|
||||
pro_payload = {
|
||||
"media_url": audio_url,
|
||||
"media_type": "audio",
|
||||
"plan_tier": "pro"
|
||||
}
|
||||
|
||||
print("Testing Pro Plan (with speaker identification)...")
|
||||
pro_response = requests.post(
|
||||
f"{base_url}/microdot-ai/transcribe",
|
||||
headers=headers,
|
||||
json=pro_payload
|
||||
)
|
||||
|
||||
# Check if both requests were successful
|
||||
if freemium_response.status_code == 200 and pro_response.status_code == 200:
|
||||
freemium_data = freemium_response.json()
|
||||
pro_data = pro_response.json()
|
||||
|
||||
# Save the transcripts for inspection
|
||||
with open("freemium_transcript.json", "w") as f:
|
||||
f.write(json.dumps(freemium_data, indent=4))
|
||||
|
||||
with open("pro_transcript.json", "w") as f:
|
||||
f.write(json.dumps(pro_data, indent=4))
|
||||
|
||||
print("Transcripts saved to freemium_transcript.json and pro_transcript.json")
|
||||
|
||||
# Check if the freemium plan has speaker information
|
||||
has_speaker_freemium = "speaker" in freemium_data["transcript"]["sentences"][0] if freemium_data["transcript"]["sentences"] else False
|
||||
|
||||
# Check if the pro plan has speaker information
|
||||
has_speaker_pro = "speaker" in pro_data["transcript"]["sentences"][0] if pro_data["transcript"]["sentences"] else False
|
||||
|
||||
print(f"Freemium plan has speaker information: {has_speaker_freemium}")
|
||||
print(f"Pro plan has speaker information: {has_speaker_pro}")
|
||||
|
||||
# Verify the expected behavior
|
||||
if not has_speaker_freemium and has_speaker_pro:
|
||||
print("✅ Test PASSED: Freemium plan doesn't show speakers, Pro plan does.")
|
||||
else:
|
||||
print("❌ Test FAILED: Expected behavior not observed.")
|
||||
|
||||
else:
|
||||
print(f"Freemium request status: {freemium_response.status_code}")
|
||||
print(f"Pro request status: {pro_response.status_code}")
|
||||
if freemium_response.status_code != 200:
|
||||
print(f"Freemium error: {freemium_response.text}")
|
||||
if pro_response.status_code != 200:
|
||||
print(f"Pro error: {pro_response.text}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_plan_differences()
|
||||
Reference in New Issue
Block a user