Spaces:
Runtime error
Runtime error
Add application file
Browse files
main.py
CHANGED
@@ -15,7 +15,7 @@ from pyannote.audio import Pipeline
|
|
15 |
import soundfile as sf
|
16 |
from fastapi_cors import CORS
|
17 |
DATABASE_URL = "sqlite:///./sql_app.db"
|
18 |
-
engine = create_engine(
|
19 |
Session = sessionmaker(bind=engine)
|
20 |
|
21 |
app = FastAPI()
|
@@ -319,7 +319,7 @@ async def get_en_audio(audio_url):
|
|
319 |
|
320 |
|
321 |
|
322 |
-
|
323 |
def get_all_audio_segments():
|
324 |
session=Session()
|
325 |
segments = session.query(Audio_segment).all()
|
@@ -341,7 +341,7 @@ def get_all_audio_segments():
|
|
341 |
})
|
342 |
session.close()
|
343 |
return {"segments":segment_dicts}
|
344 |
-
|
345 |
|
346 |
def extract_15_seconds(audio_data, start_time, end_time):
|
347 |
audio_segment = AudioSegment.from_file(BytesIO(audio_data), format='wav')
|
|
|
15 |
import soundfile as sf
|
16 |
from fastapi_cors import CORS
|
17 |
DATABASE_URL = "sqlite:///./sql_app.db"
|
18 |
+
engine = create_engine(f'sqlite:///sql_app.db', echo=True)
|
19 |
Session = sessionmaker(bind=engine)
|
20 |
|
21 |
app = FastAPI()
|
|
|
319 |
|
320 |
|
321 |
|
322 |
+
@app.get("/audio_segments/")
|
323 |
def get_all_audio_segments():
|
324 |
session=Session()
|
325 |
segments = session.query(Audio_segment).all()
|
|
|
341 |
})
|
342 |
session.close()
|
343 |
return {"segments":segment_dicts}
|
344 |
+
|
345 |
|
346 |
def extract_15_seconds(audio_data, start_time, end_time):
|
347 |
audio_segment = AudioSegment.from_file(BytesIO(audio_data), format='wav')
|