# ================================================================ # CityU ScamShield AI — Enhanced English Demo # AntiFraud-SFT + Acoustic Analysis + RAG + Explainable Report # # Keeps: # - AntiFraud-SFT direct audio analysis # - Librosa acoustic feature extraction # - TF-IDF RAG # - Gradio audio interface # - Existing five output fields # # Improvements: # - Fully English prompts, interface and reports # - Separate Official Facts and Scam Patterns # - More detailed evidence-based analysis # - Suggested actions and counter-question scripts # - Acoustic features are NOT treated as proof of fraud # - Transparent risk scoring and limitations # ================================================================ import os import re import html import warnings import numpy as np import torch import librosa import gradio as gr import soundfile as sf from transformers import AutoProcessor, Qwen2AudioForConditionalGeneration from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.metrics.pairwise import cosine_similarity warnings.filterwarnings("ignore") # ================================================================ # STAGE 0 — INITIALISE KNOWLEDGE BASE # ================================================================ print("Initialising CityU ScamShield knowledge base...") # IMPORTANT: # These are prototype knowledge entries. # Verify official contact details and policies against current # CityU official sources before using them in a public demo. KNOWLEDGE_BASE = [ # ------------------------------------------------------------ # A. OFFICIAL FACTS # ------------------------------------------------------------ { "type": "Official Fact", "title": "CityU General Enquiry Contact", "text": ( "City University of Hong Kong provides official contact " "channels through its website and university directory. " "Students should independently locate the relevant office " "contact details from the official CityU website. " "For general enquiries, the university main telephone " "number listed in the project source material is 3442-8888. " "Users should verify that this number remains current." ) }, { "type": "Official Fact", "title": "CityU Finance and Payment Verification", "text": ( "Students should verify tuition fees, payment instructions, " "refunds and financial matters through official CityU " "systems and Finance Office contact channels. " "Unexpected requests to transfer money to personal bank " "accounts should be independently verified." ) }, { "type": "Official Fact", "title": "CityU Student Residence Matters", "text": ( "Student residence matters, including room allocation, " "residence fees, withdrawal and administrative procedures, " "should be checked through official Student Residence " "Office channels and published university procedures." ) }, { "type": "Official Fact", "title": "CityU Information Security", "text": ( "Students should protect their university accounts, " "passwords and verification codes. Suspicious links, " "unexpected login requests and requests for confidential " "credentials should be verified through official " "information security channels." ) }, { "type": "Official Fact", "title": "Independent Verification", "text": ( "When receiving an unexpected call claiming to represent " "CityU, students should end the interaction if necessary " "and independently contact the relevant university office " "using contact details obtained from the official website. " "They should not rely on telephone numbers or links " "provided by the caller." ) }, # ------------------------------------------------------------ # B. SCAM PATTERNS # ------------------------------------------------------------ { "type": "Scam Pattern", "title": "OTP and Verification Code Requests", "text": ( "Scammers may request one-time passwords, SMS verification " "codes, login codes or account authentication information. " "They may claim that the code is needed to verify identity, " "resolve an account problem or prevent account suspension." ) }, { "type": "Scam Pattern", "title": "Safe Account and Urgent Transfers", "text": ( "Scammers impersonating law enforcement officers, banks " "or government officials may claim that a victim's bank " "account is involved in money laundering or criminal " "activity. They may instruct the victim to transfer money " "to a so-called safe account." ) }, { "type": "Scam Pattern", "title": "Threats and Intimidation", "text": ( "Scammers may threaten arrest, prosecution, deportation, " "visa cancellation or other serious consequences to " "frighten victims into immediate compliance." ) }, { "type": "Scam Pattern", "title": "Institutional Impersonation", "text": ( "Scammers may impersonate university staff, police officers, " "immigration officers, bank employees or government " "representatives to establish false credibility." ) }, { "type": "Scam Pattern", "title": "Secrecy and Isolation", "text": ( "Scammers may instruct victims not to tell family members, " "friends, university staff or other authorities. They may " "claim that discussing the case will interfere with an " "investigation." ) }, { "type": "Scam Pattern", "title": "Suspicious Links and Remote Access", "text": ( "Scammers may send suspicious links, request account " "credentials, ask victims to install remote access " "applications or persuade them to share their screens." ) }, { "type": "Scam Pattern", "title": "Student Visa and Immigration Threats", "text": ( "Scammers may claim that a student's visa, immigration " "status or university enrolment will be cancelled unless " "an urgent payment or verification action is completed." ) } ] # Build separate retrieval indexes for the two evidence categories. # This prevents official institutional information from being # confused with scam-pattern evidence. OFFICIAL_DOCS = [ x for x in KNOWLEDGE_BASE if x["type"] == "Official Fact" ] SCAM_DOCS = [ x for x in KNOWLEDGE_BASE if x["type"] == "Scam Pattern" ] official_vectorizer = TfidfVectorizer( lowercase=True, ngram_range=(1, 2), sublinear_tf=True ) scam_vectorizer = TfidfVectorizer( lowercase=True, ngram_range=(1, 2), sublinear_tf=True ) official_matrix = official_vectorizer.fit_transform( [x["text"] + " " + x["title"] for x in OFFICIAL_DOCS] ) scam_matrix = scam_vectorizer.fit_transform( [x["text"] + " " + x["title"] for x in SCAM_DOCS] ) def retrieve_rag_context(query, top_k=3): """ Retrieve official facts and scam patterns separately. Returns a detailed English evidence summary. """ if not query or not query.strip(): return ( "No sufficiently clear transcript was available. " "RAG retrieval was therefore limited." ) results = [] # Official facts q_official = official_vectorizer.transform([query]) official_scores = cosine_similarity( q_official, official_matrix )[0] official_indices = np.argsort(official_scores)[::-1][:top_k] results.append("### A. Official CityU Information") found_official = False for idx in official_indices: score = float(official_scores[idx]) if score >= 0.05: found_official = True doc = OFFICIAL_DOCS[idx] results.append( f"- **{doc['title']}** " f"(similarity: {score:.3f})\n" f" {doc['text']}" ) if not found_official: results.append( "- No sufficiently similar official information " "was retrieved from the current prototype knowledge base." ) # Scam patterns q_scam = scam_vectorizer.transform([query]) scam_scores = cosine_similarity( q_scam, scam_matrix )[0] scam_indices = np.argsort(scam_scores)[::-1][:top_k] results.append("\n### B. Relevant Scam Patterns") found_scam = False for idx in scam_indices: score = float(scam_scores[idx]) if score >= 0.05: found_scam = True doc = SCAM_DOCS[idx] results.append( f"- **{doc['title']}** " f"(similarity: {score:.3f})\n" f" {doc['text']}" ) if not found_scam: results.append( "- No sufficiently similar predefined scam pattern " "was retrieved. This does not prove the call is safe." ) results.append( "\n*Note: Similarity scores indicate textual relevance, " "not fraud probability or proof of identity.*" ) return "\n".join(results) # ================================================================ # STAGE 1 — LOAD ANTIFRAUD-SFT # ================================================================ print("Loading AntiFraud-SFT model...") model_id = "JimmyMa99/AntiFraud-SFT" device = "cuda" if torch.cuda.is_available() else "cpu" dtype = ( torch.float16 if device == "cuda" else torch.float32 ) processor = AutoProcessor.from_pretrained(model_id) # Removed device_map="auto" to prevent out-of-memory errors on free CPU model = Qwen2AudioForConditionalGeneration.from_pretrained( model_id, torch_dtype=torch.float32 ).to(device) model.eval() print(f"AntiFraud-SFT loaded successfully. Device: {device}") # ================================================================ # STAGE 2 — DIRECT AUDIO SEMANTIC ANALYSIS # ================================================================ def analyze_semantic(audio_path): """ AntiFraud-SFT analyses the original audio directly. It is not used as a text-only classifier. """ try: if not os.path.exists(audio_path): return 0.5, "Audio file not found.", "" # Load and limit audio duration y, sr = librosa.load( audio_path, sr=16000, mono=True ) y = y[:16000 * 15] if len(y) == 0: return 0.5, "The audio file is empty.", "" temp_path = "temp_audio_15s.wav" sf.write(temp_path, y, sr) conversation = [ { "role": "user", "content": [ { "type": "audio", "audio_url": temp_path }, { "type": "text", "text": ( "Please analyse this audio recording directly. " "First, transcribe the audible speech as accurately " "as possible in English. Then assess whether the " "conversation contains potential telephone scam " "indicators. Pay attention to requests for OTPs, " "passwords, money transfers, safe accounts, " "threats, impersonation, secrecy, suspicious links " "or remote access. " "Do not classify a person as fraudulent based " "only on their voice, pitch, loudness or speaking " "style. If the evidence is insufficient, state " "that clearly. " "Use exactly this structure:\n" "TRANSCRIPT: ...\n" "ASSESSMENT: Potential Scam / Suspicious / " "No Clear Scam Indicators / Inconclusive\n" "EVIDENCE: ...\n" "EXPLANATION: ...\n" "LIMITATIONS: ..." ) } ] } ] prompt_text = processor.apply_chat_template( conversation, add_generation_prompt=True, tokenize=False ) inputs = processor( text=prompt_text, audios=[temp_path], return_tensors="pt", padding=True ).to(model.device) with torch.inference_mode(): generated_ids = model.generate( **inputs, max_new_tokens=220, do_sample=False ) generated_ids = generated_ids[ :, inputs.input_ids.size(1): ] response = processor.batch_decode( generated_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False )[0].strip() if not response: return ( 0.5, "The model completed inference but returned an empty response. " "The semantic assessment is inconclusive.", "" ) # Extract transcript if the model follows the requested format transcript = "" match = re.search( r"TRANSCRIPT\s*:\s*(.*?)(?=\nASSESSMENT\s*:|\Z)", response, flags=re.IGNORECASE | re.DOTALL ) if match: transcript = match.group(1).strip() # Transparent heuristic mapping of model wording. # This is NOT a calibrated probability. lower_response = response.lower() if ( "potential scam" in lower_response or "likely scam" in lower_response or "fraudulent" in lower_response ): semantic_score = 0.85 elif "suspicious" in lower_response: semantic_score = 0.65 elif ( "no clear scam indicators" in lower_response or "no obvious scam" in lower_response ): semantic_score = 0.20 else: semantic_score = 0.50 return semantic_score, response, transcript except Exception as e: return ( 0.5, f"AntiFraud-SFT analysis error: {str(e)}", "" ) # ================================================================ # STAGE 3 — ACOUSTIC FEATURE ANALYSIS # ================================================================ def analyze_acoustic(audio_path): """ Extract descriptive acoustic measurements. These measurements are NOT validated fraud indicators. """ try: y, sr = librosa.load( audio_path, sr=16000, mono=True ) if len(y) == 0: return 0.0, "The audio file is empty." rms = librosa.feature.rms(y=y)[0] pitches, magnitudes = librosa.piptrack( y=y, sr=sr ) valid_pitches = pitches[pitches > 0] energy = float(np.mean(rms)) pitch_mean = ( float(np.mean(valid_pitches)) if len(valid_pitches) > 0 else 0.0 ) pitch_std = ( float(np.std(valid_pitches)) if len(valid_pitches) > 0 else 0.0 ) duration = len(y) / sr zcr = float( np.mean( librosa.feature.zero_crossing_rate(y=y) ) ) spectral_centroid = float( np.mean( librosa.feature.spectral_centroid( y=y, sr=sr ) ) ) details = ( f"Duration: {duration:.2f} seconds | " f"Sampling rate: {sr} Hz | " f"Mean RMS energy: {energy:.4f} | " f"Mean pitch: {pitch_mean:.2f} Hz | " f"Pitch variation (standard deviation): {pitch_std:.2f} Hz | " f"Zero-crossing rate: {zcr:.4f} | " f"Spectral centroid: {spectral_centroid:.2f} Hz" ) # Deliberately do not convert acoustic measurements # into a fraud-risk score. acoustic_score = 0.0 return acoustic_score, details except Exception as e: return 0.0, f"Acoustic analysis error: {str(e)}" # ================================================================ # STAGE 4 — EVIDENCE AND RECOMMENDATION HELPERS # ================================================================ SCAM_INDICATORS = { "OTP / verification code": [ "otp", "one-time password", "verification code", "authentication code", "sms code" ], "Password / account credentials": [ "password", "login details", "account credentials", "username", "passcode" ], "Urgent payment / money transfer": [ "transfer money", "wire transfer", "make a payment", "send money", "bank transfer", "deposit" ], "Safe account": [ "safe account", "secure account", "temporary account" ], "Threats / intimidation": [ "arrest", "criminal case", "prosecution", "illegal activity", "police investigation", "deportation", "visa cancellation" ], "Urgency / pressure": [ "immediately", "right now", "urgent", "within one hour", "final warning" ], "Impersonation": [ "police officer", "immigration officer", "government officer", "university officer", "finance office", "bank officer" ], "Secrecy / isolation": [ "do not tell anyone", "keep this confidential", "tell nobody", "do not contact anyone" ], "Suspicious links / remote access": [ "click this link", "install this application", "remote access", "share your screen" ] } def detect_text_indicators(text): """Identify explicit warning phrases in available transcript.""" if not text: return [] text_lower = text.lower() matches = [] for category, phrases in SCAM_INDICATORS.items(): found = [ phrase for phrase in phrases if phrase in text_lower ] if found: matches.append({ "category": category, "phrases": found }) return matches def make_counter_questions(matches, transcript): """ Generate practical questions that help users verify a caller. These are defensive verification scripts, not instructions to continue an unsafe conversation. """ categories = [ x["category"] for x in matches ] questions = [] questions.append( '"Could you provide your full name, department, ' 'official extension number and case reference? ' 'I will independently call the organisation to verify."' ) if "OTP / verification code" in categories: questions.append( '"Why is a verification code required? ' 'I will not disclose any OTP or authentication code. ' 'Please direct me to the official verification procedure."' ) if ( "Urgent payment / money transfer" in categories or "Safe account" in categories ): questions.append( '"Please provide the official written payment instruction. ' 'I will verify it directly with the Finance Office using ' 'contact details from the official university website."' ) if "Threats / intimidation" in categories: questions.append( '"Please provide your official agency, officer ID and ' 'case reference. I will independently contact the agency ' 'through its published official channel."' ) if "Impersonation" in categories: questions.append( '"Please provide your department and internal extension. ' 'I will call the university switchboard or the department ' 'number published on the official website."' ) if "Secrecy / isolation" in categories: questions.append( '"I do not agree to keep this confidential. ' 'I will consult the university or a trusted person ' 'before taking any action."' ) if "Suspicious links / remote access" in categories: questions.append( '"I will not open unexpected links, install software ' 'or share my screen. Please provide an official website ' 'where I can verify this request independently."' ) return questions def make_action_plan(risk_level, matches): """Create actionable safety guidance.""" actions = [ "Do not disclose passwords, OTPs, banking credentials or " "personal identification information.", "Do not transfer money or follow payment instructions " "during an unexpected call.", "Do not click suspicious links or install remote-access software.", "End the call if you feel pressured, threatened or uncertain.", "Independently contact the claimed organisation using " "contact details from its official website." ] if risk_level == "HIGH": actions.insert( 0, "Treat the interaction as high risk. Stop the requested " "transaction or disclosure immediately." ) elif risk_level == "ELEVATED": actions.insert( 0, "Pause the interaction and verify every claim before " "taking any action." ) else: actions.insert( 0, "No strong warning signal was identified by the current " "prototype, but remain cautious." ) actions.append( "If money has already been transferred or sensitive details " "have been disclosed, contact your bank and the relevant " "Hong Kong authorities promptly. You may also contact " "the Anti-Scam Helpline 18222 for advice." ) return actions # ================================================================ # STAGE 5 — MAIN PIPELINE AND PROFESSIONAL REPORT # ================================================================ def main_pipeline(audio_path): if audio_path is None: return ( "Please upload or record an audio file before analysis.", 0.0, 0.0, 0.0, "" ) # 1. Direct audio analysis semantic_score, semantic_raw, transcription = ( analyze_semantic(audio_path) ) # 2. Acoustic feature extraction acoustic_score, acoustic_details = ( analyze_acoustic(audio_path) ) # 3. Use model transcript for RAG. # If transcript extraction failed, do not invent transcript content. rag_query = transcription.strip() rag_result = retrieve_rag_context(rag_query) # 4. Detect explicit transcript indicators text_matches = detect_text_indicators(rag_query) matched_count = len(text_matches) # 5. Risk assessment # # The model score is a rough interpretation of model wording, # not a calibrated probability. # # The acoustic score is deliberately excluded. # Text matches are supporting evidence, not proof. if semantic_score >= 0.80 or matched_count >= 3: final_score = max( semantic_score, min(0.95, 0.55 + matched_count * 0.10) ) risk_level = "HIGH" risk_label = "High Risk — Multiple Warning Signals" elif semantic_score >= 0.60 or matched_count >= 1: final_score = max( semantic_score, min(0.75, 0.40 + matched_count * 0.08) ) risk_level = "ELEVATED" risk_label = "Elevated Risk — Verification Required" elif semantic_score <= 0.25: final_score = 0.20 risk_level = "LOW" risk_label = "No Clear Warning Signals Identified" else: final_score = 0.50 risk_level = "UNCERTAIN" risk_label = "Inconclusive — Further Verification Required" # 6. Suggested actions actions = make_action_plan( risk_level, text_matches ) # 7. Counter-question scripts questions = make_counter_questions( text_matches, rag_query ) # 8. Format text indicator evidence if text_matches: indicator_lines = [] for item in text_matches: phrase_text = ", ".join(item["phrases"]) indicator_lines.append( f"- **{item['category']}** — " f"Matched phrase(s): `{phrase_text}`" ) indicator_report = "\n".join(indicator_lines) else: indicator_report = ( "No predefined warning phrases were matched in the " "available transcript. This does not establish that " "the call is legitimate." ) # 9. Format actions action_report = "\n".join( f"{i + 1}. {item}" for i, item in enumerate(actions) ) # 10. Format counter questions question_report = "\n".join( f"{i + 1}. {question}" for i, question in enumerate(questions) ) if not transcription: transcript_display = ( "No transcript was extracted from the model response. " "Text-based indicator detection and RAG retrieval " "are therefore limited." ) else: transcript_display = transcription # 11. Final professional report report = f""" # CityU ScamShield AI ## Comprehensive Anti-Scam Analysis Report ### 1. Overall Assessment **Risk Classification:** {risk_label} **Prototype Risk Indicator:** `{final_score:.2f} / 1.00` **Evidence Summary:** - AntiFraud-SFT semantic assessment: `{semantic_score:.2f}` - Explicit transcript warning categories: `{matched_count}` - Acoustic measurements: extracted for description only; **not used to determine fraud risk**. > **Important:** The risk indicator is a prototype decision-support score, not a statistically validated fraud probability. It should not be treated as a final determination of whether the caller is a criminal. --- ### 2. Key Warning Indicators {indicator_report} ### 3. Recommended Immediate Actions {action_report} ### 4. Suggested Counter-Questions Use these questions to verify the caller without disclosing sensitive information: {question_report} **Recommended verification approach:** If the caller claims to represent CityU, ask for their department, name, official extension and reference number. End the call and independently contact the relevant department using contact details published on the official CityU website. Do not call back using a number supplied by the caller. --- ## Detailed Stage-by-Stage Analysis ### Stage 1 — Direct Audio Semantic Analysis (AntiFraud-SFT) **Purpose:** Analyse the original audio recording directly to identify potentially suspicious conversational content and explain the model's assessment. **Model:** `JimmyMa99/AntiFraud-SFT` **Model assessment indicator:** `{semantic_score:.2f}` **Raw model response:** {semantic_raw} **Extracted transcript:** > {transcript_display} **Interpretation:** The model's response is used as one source of evidence. Its assessment should be reviewed alongside the actual transcript and other available evidence. A model-generated label is not independent proof of fraud. ### Stage 2 — Acoustic Feature Analysis (Librosa) **Purpose:** Describe measurable characteristics of the audio signal, independently of the meaning of the spoken words. **Extracted measurements:** {acoustic_details} **Interpretation:** These measurements describe audio energy, pitch and signal characteristics. They may help inspect the recording, but they are not validated indicators of deception or criminal intent. The system therefore does not use them to increase the fraud-risk score. ### Stage 3 — Explainable Text Warning Analysis **Purpose:** Identify explicit warning phrases in the transcript extracted from the audio analysis. **Number of matched categories:** `{matched_count}` **Matched evidence:** {indicator_report} **Interpretation:** The rule-based component highlights phrases that correspond to predefined scam tactics. It may miss unfamiliar wording, transcription errors, Cantonese expressions or context-dependent meanings. A missing match does not mean the call is safe. ### Stage 4 — RAG Evidence Retrieval **Purpose:** Retrieve relevant information from two separate knowledge categories. {rag_result} **Interpretation:** Official CityU information and general scam patterns are kept separate. A caller mentioning a real university department does not establish that the caller is genuine. Likewise, retrieving a similar scam pattern does not prove that the current caller is a scammer. ### Stage 5 — Integrated Risk Assessment **Purpose:** Combine the available semantic assessment and explicit transcript warning indicators to produce a transparent prototype risk indicator. **Final classification:** {risk_label} **Prototype indicator:** `{final_score:.2f} / 1.00` **Decision basis:** - AntiFraud-SFT model response wording. - Number of predefined warning categories matched in the extracted transcript. - Acoustic features are excluded from the risk calculation. **Limitations:** - The model indicator is not calibrated against a labelled evaluation dataset. - Transcription or model-generation errors may affect the result. - The RAG knowledge base is a limited prototype collection. - No warning signals does not guarantee that a call is legitimate. - The system supports human verification and should not replace official investigations. --- ### Final Safety Reminder **When in doubt, pause and verify independently.** Never disclose an OTP, password or banking credential, and never transfer money to a so-called safe account based solely on an unexpected phone call. """ return ( report, round(final_score, 2), round(semantic_score, 2), round(acoustic_score, 2), transcription ) # ================================================================ # STAGE 6 — GRADIO INTERFACE AND CSS # ================================================================ CUSTOM_CSS = """ /* Main application */ .gradio-container { max-width: 1250px !important; margin: auto !important; } /* Main title */ #app-title { text-align: center; padding: 22px 16px; border-radius: 14px; background: linear-gradient(120deg, #102a43, #1f4e79); color: white; margin-bottom: 14px; } #app-title h1 { color: white !important; font-size: 30px !important; font-weight: 800 !important; margin-bottom: 8px; } #app-title p { color: #e7f0fa !important; font-size: 14px !important; } /* Section headings */ .section-heading { font-weight: 750; color: #17365d; margin-top: 14px; } /* Report panel */ #report-panel { border: 1px solid #d9e2ec; border-radius: 12px; padding: 18px; background: var(--block-background-fill); line-height: 1.65; } /* Buttons */ button.primary { background: #1f5f99 !important; border: none !important; font-weight: 700 !important; } /* Output cards */ .metric-card { border-radius: 10px; border: 1px solid #d9e2ec; padding: 10px; } /* Markdown content */ .prose h1, .prose h2, .prose h3 { color: #17365d; } .prose table { width: 100%; } """ with gr.Blocks( title="CityU ScamShield AI", theme=gr.themes.Soft( primary_hue="blue", secondary_hue="slate", neutral_hue="slate" ), css=CUSTOM_CSS ) as demo: gr.HTML( """

CityU ScamShield AI

AI-Assisted Telephone Scam Analysis and Independent Verification Support

""" ) gr.Markdown( """ This prototype analyses an audio recording through direct audio-language model inference, acoustic feature extraction, explainable warning detection and retrieval from a CityU-related knowledge base. **Privacy reminder:** Use test recordings or recordings that you are authorised to analyse. Avoid uploading unnecessary personal or confidential information. """ ) with gr.Row(): with gr.Column(scale=1): gr.Markdown("### 1. Audio Input") audio_input = gr.Audio( type="filepath", label="Upload or Record a Telephone Conversation" ) submit_btn = gr.Button( "Run Comprehensive Analysis", variant="primary", size="lg" ) gr.Markdown( """ **Analysis scope** - Direct audio analysis with AntiFraud-SFT - Acoustic feature extraction - Transcript warning indicators - Separate official-fact and scam-pattern retrieval """ ) with gr.Column(scale=2): gr.Markdown("### 2. Comprehensive Analysis Report") output_text = gr.Markdown( label="Analysis Report", elem_id="report-panel" ) gr.Markdown("### 3. Key Analysis Indicators") with gr.Row(): final_score_bar = gr.Number( label="Prototype Risk Indicator (Not Probability)", precision=2, interactive=False ) semantic_score_bar = gr.Number( label="AntiFraud-SFT Wording Indicator", precision=2, interactive=False ) acoustic_score_bar = gr.Number( label="Acoustic Risk Score", value=0.0, precision=2, interactive=False ) transcript_box = gr.Textbox( label="Extracted Transcript (English)", lines=5, interactive=False, placeholder="The extracted transcript will appear here." ) gr.Markdown( """ --- **Disclaimer:** CityU ScamShield AI is an experimental decision-support prototype. Its outputs are not proof of fraud and do not replace official verification, professional advice or law-enforcement investigations. """ ) submit_btn.click( fn=main_pipeline, inputs=audio_input, outputs=[ output_text, final_score_bar, semantic_score_bar, acoustic_score_bar, transcript_box ] ) # ================================================================ # LAUNCH # ================================================================ if __name__ == "__main__": demo.launch(server_name="0.0.0.0", server_port=7860)