Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -128,7 +128,7 @@ def transcribe_audio_streaming(audio_file, model_name, progress=gr.Progress()):
|
|
128 |
# Create prompt tokens for medical context
|
129 |
prompt = """ Endocrinology clinic visit transcript.
|
130 |
Previous discussion mentioned levothyroxine dose adjustment for Hashimoto’s thyroiditis and an Hemoglobin A1C review.
|
131 |
-
Terms we frequently use: levothyroxine, Synthroid, Cytomel, methimazole, propylthiouracil, PTU semaglutide, Ozempic, Mounjaro, insulin glargine, Lantus, Tresiba,
|
132 |
Common labs and hormones: TSH, free T4, free T3, HbA1C, cortisol, ACTH, parathyroid hormone, LDL, microalbumin.
|
133 |
Typical procedures: thyroid ultrasound, fine-needle aspiration biopsy, FNA, medtronics pump, Tandem pump, OmniPod pump, radioactive iodine ablation, continuous glucose monitoring, CGM, DEXA scan."""
|
134 |
prompt_ids = loaded_whisper_processor.get_prompt_ids(prompt, return_tensors="pt").to(device)
|
@@ -441,13 +441,13 @@ MEDICAL_LLM_MODELS = [
|
|
441 |
# Create Gradio interface
|
442 |
with gr.Blocks(title="Medical Transcription & Note Generation", theme=gr.themes.Soft()) as demo:
|
443 |
gr.HTML("<h1 style='text-align: center; color: #2563eb;'>🏥 Medical Transcription & Note Generation</h1>")
|
444 |
-
gr.HTML("<p style='text-align: center;'>
|
445 |
|
446 |
# Add warning about HF token
|
447 |
-
if not HF_TOKEN:
|
448 |
-
|
449 |
-
else:
|
450 |
-
|
451 |
|
452 |
with gr.Row():
|
453 |
# Left Column - Audio Recording and Transcription
|
@@ -464,7 +464,7 @@ with gr.Blocks(title="Medical Transcription & Note Generation", theme=gr.themes.
|
|
464 |
# Whisper model selection
|
465 |
whisper_model = gr.Dropdown(
|
466 |
choices=WHISPER_MODELS,
|
467 |
-
value="openai/whisper-
|
468 |
label="Select Whisper Model"
|
469 |
)
|
470 |
|
|
|
128 |
# Create prompt tokens for medical context
|
129 |
prompt = """ Endocrinology clinic visit transcript.
|
130 |
Previous discussion mentioned levothyroxine dose adjustment for Hashimoto’s thyroiditis and an Hemoglobin A1C review.
|
131 |
+
Terms we frequently use: levothyroxine, Synthroid, Cytomel, methimazole, propylthiouracil, PTU semaglutide, Ozempic, Mounjaro, insulin glargine, Lantus, Tresiba, Toujeo, Metformin, Glipizide, Januvia, Jardiance, Atorvastatin, Rosuvastatin, Pravastatin.
|
132 |
Common labs and hormones: TSH, free T4, free T3, HbA1C, cortisol, ACTH, parathyroid hormone, LDL, microalbumin.
|
133 |
Typical procedures: thyroid ultrasound, fine-needle aspiration biopsy, FNA, medtronics pump, Tandem pump, OmniPod pump, radioactive iodine ablation, continuous glucose monitoring, CGM, DEXA scan."""
|
134 |
prompt_ids = loaded_whisper_processor.get_prompt_ids(prompt, return_tensors="pt").to(device)
|
|
|
441 |
# Create Gradio interface
|
442 |
with gr.Blocks(title="Medical Transcription & Note Generation", theme=gr.themes.Soft()) as demo:
|
443 |
gr.HTML("<h1 style='text-align: center; color: #2563eb;'>🏥 Medical Transcription & Note Generation</h1>")
|
444 |
+
gr.HTML("<p style='text-align: center;'>Only for research purpose, not for clinical use.</p>")
|
445 |
|
446 |
# Add warning about HF token
|
447 |
+
#if not HF_TOKEN:
|
448 |
+
# gr.HTML("<div style='background-color: #fef3cd; border: 1px solid #ffeaa7; padding: 10px; margin: 10px 0; border-radius: 5px;'><strong>⚠️ Warning:</strong> HF_TOKEN not found. Some models may not be accessible. Please add your Hugging Face token as a Space secret.</div>")
|
449 |
+
#else:
|
450 |
+
# gr.HTML("<div style='background-color: #d4edda; border: 1px solid #c3e6cb; padding: 10px; margin: 10px 0; border-radius: 5px;'><strong>✅ Status:</strong> Hugging Face token loaded successfully.</div>")
|
451 |
|
452 |
with gr.Row():
|
453 |
# Left Column - Audio Recording and Transcription
|
|
|
464 |
# Whisper model selection
|
465 |
whisper_model = gr.Dropdown(
|
466 |
choices=WHISPER_MODELS,
|
467 |
+
value="openai/whisper-tiny",
|
468 |
label="Select Whisper Model"
|
469 |
)
|
470 |
|