Spaces:
Runtime error
Runtime error
Commit
·
ef5ad8a
1
Parent(s):
cd2a3be
update file treatment
Browse files
app.py
CHANGED
|
@@ -1110,9 +1110,10 @@ def chathmi3(message, history2):
|
|
| 1110 |
# temp = response.split("(sandbox:/")[1] # (sandbox:/sample-20230805-0807.wav)
|
| 1111 |
file_name = CheckFileinResp(response)
|
| 1112 |
print("file_name:", file_name)
|
| 1113 |
-
|
| 1114 |
-
|
| 1115 |
-
|
|
|
|
| 1116 |
except:
|
| 1117 |
print("No need to add file in chatbot")
|
| 1118 |
|
|
@@ -1129,9 +1130,11 @@ def CheckFileinResp(response):
|
|
| 1129 |
try:
|
| 1130 |
pattern = r'sample-\w+\.wav'
|
| 1131 |
result = re.findall(pattern, response)
|
|
|
|
| 1132 |
return result[-1]
|
| 1133 |
except Exception as e:
|
| 1134 |
print("No wav found:", e)
|
|
|
|
| 1135 |
|
| 1136 |
def chathmi4(message, history2):
|
| 1137 |
global last_request
|
|
@@ -1160,9 +1163,10 @@ def chathmi4(message, history2):
|
|
| 1160 |
# temp = response.split("(sandbox:/")[1] # (sandbox:/sample-20230805-0807.wav)
|
| 1161 |
file_name = CheckFileinResp(response)
|
| 1162 |
print("file_name:", file_name)
|
| 1163 |
-
|
| 1164 |
-
|
| 1165 |
-
|
|
|
|
| 1166 |
except:
|
| 1167 |
print("No need to add file in chatbot")
|
| 1168 |
|
|
|
|
| 1110 |
# temp = response.split("(sandbox:/")[1] # (sandbox:/sample-20230805-0807.wav)
|
| 1111 |
file_name = CheckFileinResp(response)
|
| 1112 |
print("file_name:", file_name)
|
| 1113 |
+
if file_name is not "N/A":
|
| 1114 |
+
history2 = history2 + [(None, (file_name,))]
|
| 1115 |
+
Filename_Chatbot = file_name
|
| 1116 |
+
yield ["", history2]
|
| 1117 |
except:
|
| 1118 |
print("No need to add file in chatbot")
|
| 1119 |
|
|
|
|
| 1130 |
try:
|
| 1131 |
pattern = r'sample-\w+\.wav'
|
| 1132 |
result = re.findall(pattern, response)
|
| 1133 |
+
print("result of check file in response:", result)
|
| 1134 |
return result[-1]
|
| 1135 |
except Exception as e:
|
| 1136 |
print("No wav found:", e)
|
| 1137 |
+
return "N/A"
|
| 1138 |
|
| 1139 |
def chathmi4(message, history2):
|
| 1140 |
global last_request
|
|
|
|
| 1163 |
# temp = response.split("(sandbox:/")[1] # (sandbox:/sample-20230805-0807.wav)
|
| 1164 |
file_name = CheckFileinResp(response)
|
| 1165 |
print("file_name:", file_name)
|
| 1166 |
+
if file_name is not "N/A":
|
| 1167 |
+
history2 = history2 + [(None, (file_name,))]
|
| 1168 |
+
Filename_Chatbot = file_name
|
| 1169 |
+
yield ["", history2, "SUBMIT", "STOP"]
|
| 1170 |
except:
|
| 1171 |
print("No need to add file in chatbot")
|
| 1172 |
|