Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
277e7aea
Commit
277e7aea
authored
Jun 08, 2024
by
Timothy J. Baek
Browse files
refac
parent
1271d1dc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
backend/apps/audio/main.py
backend/apps/audio/main.py
+9
-2
No files found.
backend/apps/audio/main.py
View file @
277e7aea
...
@@ -273,7 +273,11 @@ def transcribe(
...
@@ -273,7 +273,11 @@ def transcribe(
with
open
(
transcript_file
,
"w"
)
as
f
:
with
open
(
transcript_file
,
"w"
)
as
f
:
json
.
dump
({
"transcript"
:
transcript
},
f
)
json
.
dump
({
"transcript"
:
transcript
},
f
)
return
{
"text"
:
transcript
.
strip
()}
data
=
{
"text"
:
transcript
.
strip
()}
print
(
data
)
return
data
elif
app
.
state
.
config
.
STT_ENGINE
==
"openai"
:
elif
app
.
state
.
config
.
STT_ENGINE
==
"openai"
:
headers
=
{
"Authorization"
:
f
"Bearer
{
app
.
state
.
config
.
STT_OPENAI_API_KEY
}
"
}
headers
=
{
"Authorization"
:
f
"Bearer
{
app
.
state
.
config
.
STT_OPENAI_API_KEY
}
"
}
...
@@ -291,7 +295,10 @@ def transcribe(
...
@@ -291,7 +295,10 @@ def transcribe(
)
)
r
.
raise_for_status
()
r
.
raise_for_status
()
return
r
.
json
()
data
=
r
.
json
()
print
(
data
)
return
data
except
Exception
as
e
:
except
Exception
as
e
:
log
.
exception
(
e
)
log
.
exception
(
e
)
error_detail
=
"Open WebUI: Server Connection Error"
error_detail
=
"Open WebUI: Server Connection Error"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment