Spaces:
Runtime error
Runtime error
Alexander Seifert
commited on
Commit
·
161a5eb
1
Parent(s):
15a2fa0
remove email
Browse files
app.py
CHANGED
@@ -11,7 +11,7 @@ model_key = os.environ["BANANA_MODEL_KEY"]
|
|
11 |
password = os.environ["PASSWORD"]
|
12 |
|
13 |
|
14 |
-
def transcribe(
|
15 |
if file:
|
16 |
with open(file, "rb") as f:
|
17 |
audio = f.read()
|
@@ -19,7 +19,7 @@ def transcribe(email: str, file=None, url=None):
|
|
19 |
payload = {"audio_b64": audio_b64}
|
20 |
else:
|
21 |
payload = {"url": url}
|
22 |
-
payload["email"] = email
|
23 |
response = banana.run(api_key, model_key, payload)
|
24 |
print(response)
|
25 |
|
@@ -30,7 +30,7 @@ def transcribe(email: str, file=None, url=None):
|
|
30 |
return response["modelOutputs"][0]
|
31 |
|
32 |
|
33 |
-
def run_demo(
|
34 |
if password != os.environ["PASSWORD"]:
|
35 |
raise gr.Error("Der Zugriffscode ist falsch.")
|
36 |
|
@@ -48,7 +48,7 @@ def run_demo(email, password, microphone, file_upload):
|
|
48 |
file = microphone if microphone is not None else file_upload
|
49 |
|
50 |
start = time.time()
|
51 |
-
transcription = transcribe(
|
52 |
logger.info(f"transcription took {time.time()-start:.3f}s")
|
53 |
return "\n\n".join([seg["text"].strip() for seg in transcription["segments"]])
|
54 |
|
@@ -56,7 +56,7 @@ def run_demo(email, password, microphone, file_upload):
|
|
56 |
demo = gr.Interface(
|
57 |
fn=run_demo,
|
58 |
inputs=[
|
59 |
-
gr.Textbox(label="Email", type="email"),
|
60 |
gr.Textbox(label="Zugriffscode (siehe oben)"),
|
61 |
gr.Audio(source="microphone", type="filepath", label="Aufnehmen"),
|
62 |
gr.Audio(source="upload", type="filepath", label="Datei hochladen"),
|
|
|
11 |
password = os.environ["PASSWORD"]
|
12 |
|
13 |
|
14 |
+
def transcribe(file=None, url=None):
|
15 |
if file:
|
16 |
with open(file, "rb") as f:
|
17 |
audio = f.read()
|
|
|
19 |
payload = {"audio_b64": audio_b64}
|
20 |
else:
|
21 |
payload = {"url": url}
|
22 |
+
# payload["email"] = email
|
23 |
response = banana.run(api_key, model_key, payload)
|
24 |
print(response)
|
25 |
|
|
|
30 |
return response["modelOutputs"][0]
|
31 |
|
32 |
|
33 |
+
def run_demo(password, microphone, file_upload):
|
34 |
if password != os.environ["PASSWORD"]:
|
35 |
raise gr.Error("Der Zugriffscode ist falsch.")
|
36 |
|
|
|
48 |
file = microphone if microphone is not None else file_upload
|
49 |
|
50 |
start = time.time()
|
51 |
+
transcription = transcribe(file)
|
52 |
logger.info(f"transcription took {time.time()-start:.3f}s")
|
53 |
return "\n\n".join([seg["text"].strip() for seg in transcription["segments"]])
|
54 |
|
|
|
56 |
demo = gr.Interface(
|
57 |
fn=run_demo,
|
58 |
inputs=[
|
59 |
+
# gr.Textbox(label="Email", type="email"),
|
60 |
gr.Textbox(label="Zugriffscode (siehe oben)"),
|
61 |
gr.Audio(source="microphone", type="filepath", label="Aufnehmen"),
|
62 |
gr.Audio(source="upload", type="filepath", label="Datei hochladen"),
|