Spaces:
Running
Running
Upload simple_casl_app.py
Browse files- simple_casl_app.py +0 -33
simple_casl_app.py
CHANGED
@@ -1105,19 +1105,6 @@ with gr.Blocks(title="Enhanced Speech Sample Analysis", theme=gr.themes.Soft())
|
|
1105 |
"π Analyze Text",
|
1106 |
variant="primary"
|
1107 |
)
|
1108 |
-
|
1109 |
-
with gr.Tab("π€ Audio/Video Transcription"):
|
1110 |
-
audio_input = gr.File(
|
1111 |
-
label="Upload Audio/Video File",
|
1112 |
-
file_types=["audio", "video"]
|
1113 |
-
)
|
1114 |
-
|
1115 |
-
transcribe_btn = gr.Button(
|
1116 |
-
"π€ Transcribe & Analyze",
|
1117 |
-
variant="primary"
|
1118 |
-
)
|
1119 |
-
|
1120 |
-
transcription_status = gr.Markdown("")
|
1121 |
|
1122 |
gr.Markdown("### Patient Information")
|
1123 |
|
@@ -1272,19 +1259,6 @@ with gr.Blocks(title="Enhanced Speech Sample Analysis", theme=gr.themes.Soft())
|
|
1272 |
progress_msg = "β
Analysis completed" if "[Analysis completed in" in result else "π Analysis in progress..."
|
1273 |
return result, text, progress_msg
|
1274 |
|
1275 |
-
def on_transcribe_and_analyze(audio_file, age_val, gender_val, notes):
|
1276 |
-
"""Handle transcription and analysis"""
|
1277 |
-
if not audio_file:
|
1278 |
-
return "Please upload an audio/video file first.", "", "No file provided"
|
1279 |
-
|
1280 |
-
transcript, status = transcribe_audio(audio_file.name)
|
1281 |
-
if transcript:
|
1282 |
-
result = analyze_transcript_content(transcript, age_val, gender_val, notes)
|
1283 |
-
progress_msg = "β
Analysis completed" if "[Analysis completed in" in result else "π Analysis in progress..."
|
1284 |
-
return result, transcript, status
|
1285 |
-
else:
|
1286 |
-
return f"Transcription failed: {status}", "", status
|
1287 |
-
|
1288 |
def on_targeted_analyze(transcript, question, age_val, gender_val, notes):
|
1289 |
"""Handle targeted analysis"""
|
1290 |
result = targeted_analysis(transcript, question, age_val, gender_val, notes)
|
@@ -1479,12 +1453,6 @@ with gr.Blocks(title="Enhanced Speech Sample Analysis", theme=gr.themes.Soft())
|
|
1479 |
outputs=[output, transcript_input, analysis_progress]
|
1480 |
)
|
1481 |
|
1482 |
-
transcribe_btn.click(
|
1483 |
-
on_transcribe_and_analyze,
|
1484 |
-
inputs=[audio_input, age, gender, slp_notes],
|
1485 |
-
outputs=[output, transcript_input, transcription_status]
|
1486 |
-
)
|
1487 |
-
|
1488 |
targeted_analyze_btn.click(
|
1489 |
on_targeted_analyze,
|
1490 |
inputs=[transcript_input, custom_question, age, gender, slp_notes],
|
@@ -1506,7 +1474,6 @@ with gr.Blocks(title="Enhanced Speech Sample Analysis", theme=gr.themes.Soft())
|
|
1506 |
if __name__ == "__main__":
|
1507 |
print("π Starting Enhanced Speech Sample Analysis Tool...")
|
1508 |
print("π Features: Basic Analysis, Targeted Questions, Quick Multi-Analysis")
|
1509 |
-
print("π€ Transcription: Audio/Video support with basic transcription")
|
1510 |
print("π Analysis: Complex sentences, figurative language, pragmatic skills, cognitive-linguistic factors")
|
1511 |
|
1512 |
if not ANTHROPIC_API_KEY:
|
|
|
1105 |
"π Analyze Text",
|
1106 |
variant="primary"
|
1107 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1108 |
|
1109 |
gr.Markdown("### Patient Information")
|
1110 |
|
|
|
1259 |
progress_msg = "β
Analysis completed" if "[Analysis completed in" in result else "π Analysis in progress..."
|
1260 |
return result, text, progress_msg
|
1261 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1262 |
def on_targeted_analyze(transcript, question, age_val, gender_val, notes):
|
1263 |
"""Handle targeted analysis"""
|
1264 |
result = targeted_analysis(transcript, question, age_val, gender_val, notes)
|
|
|
1453 |
outputs=[output, transcript_input, analysis_progress]
|
1454 |
)
|
1455 |
|
|
|
|
|
|
|
|
|
|
|
|
|
1456 |
targeted_analyze_btn.click(
|
1457 |
on_targeted_analyze,
|
1458 |
inputs=[transcript_input, custom_question, age, gender, slp_notes],
|
|
|
1474 |
if __name__ == "__main__":
|
1475 |
print("π Starting Enhanced Speech Sample Analysis Tool...")
|
1476 |
print("π Features: Basic Analysis, Targeted Questions, Quick Multi-Analysis")
|
|
|
1477 |
print("π Analysis: Complex sentences, figurative language, pragmatic skills, cognitive-linguistic factors")
|
1478 |
|
1479 |
if not ANTHROPIC_API_KEY:
|