Update app.py
Browse files
app.py
CHANGED
@@ -54,22 +54,21 @@ def switching(text):
|
|
54 |
result = chat.chatting(prompt=prompt if prompt is not None else text)
|
55 |
|
56 |
print(f"Prompt:\n{prompt}")
|
57 |
-
prompt = None
|
58 |
return result
|
59 |
|
60 |
|
61 |
def main():
|
62 |
try:
|
63 |
mic = mic_recorder(start_prompt="Record", stop_prompt="Stop", just_once=True, use_container_width=True)
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
execution_time = time.perf_counter() - start_time
|
71 |
-
print(f"App.py -> main() -> time of execution A2T -> {execution_time}s")
|
72 |
|
|
|
|
|
73 |
output = switching(text)
|
74 |
response = remove_labels_with_regex(text=output)
|
75 |
start_time_t2a = time.perf_counter()
|
@@ -77,11 +76,10 @@ def main():
|
|
77 |
execution_time_t2a = time.perf_counter() - start_time_t2a
|
78 |
print(f"App.py -> main() -> time of execution T2A -> {execution_time_t2a}s")
|
79 |
print(ic.pil_image)
|
80 |
-
|
81 |
if response:
|
82 |
st.markdown(f"Your input: {text}")
|
83 |
st.markdown(f"Chelsea response: {response}")
|
84 |
-
response = None
|
85 |
|
86 |
except Exception as e:
|
87 |
print(f"An error occurred in main finction, reasone is: {e}")
|
|
|
54 |
result = chat.chatting(prompt=prompt if prompt is not None else text)
|
55 |
|
56 |
print(f"Prompt:\n{prompt}")
|
|
|
57 |
return result
|
58 |
|
59 |
|
60 |
def main():
|
61 |
try:
|
62 |
mic = mic_recorder(start_prompt="Record", stop_prompt="Stop", just_once=True, use_container_width=True)
|
63 |
+
start_time = time.perf_counter()
|
64 |
+
a2t = A2T(mic["bytes"]) if mic else None
|
65 |
+
text = a2t.predict()
|
66 |
+
print(f"Text from A2T:\n{text}")
|
67 |
+
execution_time = time.perf_counter() - start_time
|
68 |
+
print(f"App.py -> main() -> time of execution A2T -> {execution_time}s")
|
|
|
|
|
69 |
|
70 |
+
if text and text.strip() != "":
|
71 |
+
print(f"Checking for execution this part {random.randint(0, 5)}")
|
72 |
output = switching(text)
|
73 |
response = remove_labels_with_regex(text=output)
|
74 |
start_time_t2a = time.perf_counter()
|
|
|
76 |
execution_time_t2a = time.perf_counter() - start_time_t2a
|
77 |
print(f"App.py -> main() -> time of execution T2A -> {execution_time_t2a}s")
|
78 |
print(ic.pil_image)
|
79 |
+
|
80 |
if response:
|
81 |
st.markdown(f"Your input: {text}")
|
82 |
st.markdown(f"Chelsea response: {response}")
|
|
|
83 |
|
84 |
except Exception as e:
|
85 |
print(f"An error occurred in main finction, reasone is: {e}")
|