Update app.py
Browse files
app.py
CHANGED
@@ -13,35 +13,11 @@ from matcha.text import sequence_to_text, text_to_sequence
|
|
13 |
from matcha.utils.utils import intersperse
|
14 |
import gradio as gr
|
15 |
import requests
|
16 |
-
import sentry_sdk
|
17 |
-
from sentry_sdk import capture_message, capture_exception
|
18 |
from datetime import datetime
|
19 |
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
def log_user_request(user_input: str, speaking_rate:float, device:str, execution_time:str):
|
25 |
-
"""
|
26 |
-
Logs the user's request and the current date in Sentry.
|
27 |
-
Args:
|
28 |
-
user_input (str): User entered text.
|
29 |
-
speaking_rate (float): Rate of speech.
|
30 |
-
device (str): Available device.
|
31 |
-
execution_time (str): Generation time in seconds
|
32 |
-
"""
|
33 |
-
|
34 |
-
current_datetime = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
35 |
-
|
36 |
-
with sentry_sdk.push_scope() as scope:
|
37 |
-
scope.set_tag("event_type", "user_request")
|
38 |
-
scope.set_extra("user_input", user_input)
|
39 |
-
scope.set_extra("speaking_rate", str(speaking_rate))
|
40 |
-
scope.set_extra("device", device)
|
41 |
-
scope.set_extra("timestamp", current_datetime)
|
42 |
-
scope.set_extra("execution_time", f'{execution_time} sec')
|
43 |
-
|
44 |
-
sentry_sdk.capture_message("User request")
|
45 |
|
46 |
def download_file(url, save_path):
|
47 |
response = requests.get(url)
|
|
|
13 |
from matcha.utils.utils import intersperse
|
14 |
import gradio as gr
|
15 |
import requests
|
|
|
|
|
16 |
from datetime import datetime
|
17 |
|
18 |
+
|
19 |
+
|
20 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
def download_file(url, save_path):
|
23 |
response = requests.get(url)
|