Skip to content

Commit

Permalink
fix split problem
Browse files Browse the repository at this point in the history
  • Loading branch information
cylqqqcyl committed Nov 15, 2023
1 parent d7de232 commit 4b97b1b
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions app/backend/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@
from sqlalchemy import and_, or_
from gradio_client import Client
import uuid
import platform

# Identify the current operating system
current_os = platform.system()

if current_os == 'Windows':
path_delimiter = '\\'
else:
path_delimiter = '/'

chat_history = [
]
Expand Down Expand Up @@ -82,7 +91,7 @@ def tts():
)
print("result:")
print(result[1])
dirname, filename = result[1].split('\\')[-2], result[1].split('\\')[-1]
dirname, filename = result[1].split(path_delimiter)[-2], result[1].split(path_delimiter)[-1]
newfilename = dirname + '.wav'
# move file one level up
os.rename(os.path.join('cache', dirname, filename), os.path.join('cache', newfilename))
Expand Down Expand Up @@ -230,7 +239,7 @@ def tts_for_chat(text,charactor):
)
print("result:")
print(result[1])
dirname, filename = result[1].split('\\')[-2], result[1].split('\\')[-1]
dirname, filename = result[1].split(path_delimiter)[-2], result[1].split(path_delimiter)[-1]
newfilename = dirname + '.wav'
# move file one level up
os.rename(os.path.join('cache', dirname, filename), os.path.join('cache', newfilename))
Expand Down

0 comments on commit 4b97b1b

Please sign in to comment.