Spaces:
Sleeping
Sleeping
Initial commit with FastAPI + Gradio app
Browse files
app.py
CHANGED
@@ -1,10 +1,8 @@
|
|
1 |
import io
|
2 |
import tempfile
|
3 |
-
import
|
4 |
-
import gradio as gr
|
5 |
-
from fastapi import FastAPI, File, UploadFile, HTTPException
|
6 |
from speechbrain.inference import SpeakerRecognition
|
7 |
-
|
8 |
|
9 |
# Initialize the speaker verification model
|
10 |
verification = SpeakerRecognition.from_hparams(
|
@@ -66,8 +64,8 @@ def gradio_interface():
|
|
66 |
return gr.Interface(
|
67 |
fn=compare_voices_api, # FastAPI function is wrapped here
|
68 |
inputs=[
|
69 |
-
gr.Audio(type="
|
70 |
-
gr.Audio(type="
|
71 |
],
|
72 |
outputs="json", # Output as JSON
|
73 |
live=False # No live interface, just the API
|
@@ -77,8 +75,8 @@ def gradio_interface():
|
|
77 |
@app.on_event("startup")
|
78 |
async def startup():
|
79 |
gr.Interface(fn=compare_voices_api, inputs=[
|
80 |
-
gr.Audio(type="
|
81 |
-
gr.Audio(type="
|
82 |
], outputs="json", live=False).launch(share=True, inline=True)
|
83 |
|
84 |
# Running the FastAPI app with Gradio
|
|
|
1 |
import io
|
2 |
import tempfile
|
3 |
+
from fastapi import FastAPI, HTTPException, File, UploadFile
|
|
|
|
|
4 |
from speechbrain.inference import SpeakerRecognition
|
5 |
+
import gradio as gr
|
6 |
|
7 |
# Initialize the speaker verification model
|
8 |
verification = SpeakerRecognition.from_hparams(
|
|
|
64 |
return gr.Interface(
|
65 |
fn=compare_voices_api, # FastAPI function is wrapped here
|
66 |
inputs=[
|
67 |
+
gr.Audio(type="filepath", label="First Audio File"), # Corrected type to 'filepath'
|
68 |
+
gr.Audio(type="filepath", label="Second Audio File") # Corrected type to 'filepath'
|
69 |
],
|
70 |
outputs="json", # Output as JSON
|
71 |
live=False # No live interface, just the API
|
|
|
75 |
@app.on_event("startup")
|
76 |
async def startup():
|
77 |
gr.Interface(fn=compare_voices_api, inputs=[
|
78 |
+
gr.Audio(type="filepath", label="First Audio File"), # Corrected type to 'filepath'
|
79 |
+
gr.Audio(type="filepath", label="Second Audio File") # Corrected type to 'filepath'
|
80 |
], outputs="json", live=False).launch(share=True, inline=True)
|
81 |
|
82 |
# Running the FastAPI app with Gradio
|