Seicas commited on
Commit
bb27d06
·
verified ·
1 Parent(s): 8d7e539

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -5
app.py CHANGED
@@ -6,6 +6,7 @@ import os
6
  import tempfile
7
  import json
8
  from typing import Optional
 
9
  from preprocessing import clean_audio
10
  from asr import transcribe_file, MedicalASR
11
  from diarization import diarize_segments
@@ -23,6 +24,19 @@ THEME = gr.themes.Soft(
23
  )
24
  LOGO = "assets/pediatric_logo.png" # Logo ekleyin (opsiyonel)
25
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  # FastAPI uygulaması
27
  app = FastAPI(title="Pediatrik ASR API")
28
 
@@ -120,11 +134,9 @@ with gr.Blocks(title="Tıbbi Konuşma Transkripsiyon Servisi") as demo:
120
 
121
  with gr.Row():
122
  with gr.Column():
123
- audio_input = gr.Audio(
124
- label="Ses Dosyası",
125
- type="filepath",
126
- source="upload"
127
- )
128
 
129
  with gr.Row():
130
  diarize = gr.Checkbox(label="Konuşmacı Ayrımı", value=True)
 
6
  import tempfile
7
  import json
8
  from typing import Optional
9
+ import spacy
10
  from preprocessing import clean_audio
11
  from asr import transcribe_file, MedicalASR
12
  from diarization import diarize_segments
 
24
  )
25
  LOGO = "assets/pediatric_logo.png" # Logo ekleyin (opsiyonel)
26
 
27
+ # SpaCy modelini yükle
28
+ def load_tr_spacy():
29
+ try:
30
+ return spacy.load("tr_core_news_md")
31
+ except OSError:
32
+ # Model yoksa indir
33
+ import subprocess, sys
34
+ subprocess.check_call([sys.executable, "-m", "spacy", "download", "tr_core_news_md"])
35
+ return spacy.load("tr_core_news_md")
36
+
37
+ # SpaCy modelini başlangıçta yükle
38
+ nlp = load_tr_spacy()
39
+
40
  # FastAPI uygulaması
41
  app = FastAPI(title="Pediatrik ASR API")
42
 
 
134
 
135
  with gr.Row():
136
  with gr.Column():
137
+ # Eski gr.Audio yerine gr.inputs.Audio kullan
138
+ from gradio.inputs import Audio as AudioInput
139
+ audio_input = AudioInput(type="filepath")
 
 
140
 
141
  with gr.Row():
142
  diarize = gr.Checkbox(label="Konuşmacı Ayrımı", value=True)