Spaces:
Running
Running
Update utils.py
Browse files
utils.py
CHANGED
@@ -25,6 +25,9 @@ def transcribe_audio(audio_path, language="English"):
|
|
25 |
return result['text']
|
26 |
|
27 |
def save_audio_file(uploaded_file, filename):
|
|
|
|
|
|
|
28 |
path = os.path.join("audio", filename)
|
29 |
os.makedirs("audio", exist_ok=True)
|
30 |
with open(path, "wb") as f:
|
@@ -32,6 +35,9 @@ def save_audio_file(uploaded_file, filename):
|
|
32 |
return path
|
33 |
|
34 |
def save_chat_history(history, filename="chat_history.json"):
|
|
|
|
|
|
|
35 |
os.makedirs("history", exist_ok=True)
|
36 |
with open(os.path.join("history", filename), "w") as f:
|
37 |
json.dump(history, f, indent=4)
|
|
|
25 |
return result['text']
|
26 |
|
27 |
def save_audio_file(uploaded_file, filename):
|
28 |
+
"""
|
29 |
+
Save uploaded audio to a file.
|
30 |
+
"""
|
31 |
path = os.path.join("audio", filename)
|
32 |
os.makedirs("audio", exist_ok=True)
|
33 |
with open(path, "wb") as f:
|
|
|
35 |
return path
|
36 |
|
37 |
def save_chat_history(history, filename="chat_history.json"):
|
38 |
+
"""
|
39 |
+
Save conversation history to a JSON file.
|
40 |
+
"""
|
41 |
os.makedirs("history", exist_ok=True)
|
42 |
with open(os.path.join("history", filename), "w") as f:
|
43 |
json.dump(history, f, indent=4)
|