Spaces:
Running
Running
Update app.py
Browse files
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 |
-
|
124 |
-
|
125 |
-
|
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)
|