Spaces:
Runtime error
Runtime error
Commit
·
739a7b0
1
Parent(s):
7297268
Update app.py
Browse files
app.py
CHANGED
@@ -41,12 +41,7 @@ def get_chunk_times(in_filename, silence_threshold, silence_duration=1):
|
|
41 |
|
42 |
logging.info(f"TS audio {os.path.basename(in_filename)} = {ts}")
|
43 |
return ts, chunks
|
44 |
-
|
45 |
-
def get_plot(a):
|
46 |
-
x = [1, 2, 3]
|
47 |
-
y = np.array([[1, 2], [3, 4], [5, 6]])
|
48 |
-
plt.plot(x, y)
|
49 |
-
return plt.gcf()
|
50 |
|
51 |
def get_audio_plot(filename, chunks):
|
52 |
fig, ax = plt.subplots()
|
@@ -70,9 +65,9 @@ def get_audio_plot(filename, chunks):
|
|
70 |
plt.xlabel('Time [s]')
|
71 |
plt.ylabel('Amplitude')
|
72 |
plt.title(os.path.basename(filename))
|
73 |
-
|
74 |
-
#plt.show()
|
75 |
return plt.gcf()
|
|
|
76 |
|
77 |
def get_audio_info(audio):
|
78 |
ts, chunks = get_chunk_times(audio.name, 30, 1)
|
@@ -94,47 +89,4 @@ iface = gr.Interface(
|
|
94 |
description="Enter .WAV audio to view silence areas",
|
95 |
)
|
96 |
|
97 |
-
iface.
|
98 |
-
iface.launch()
|
99 |
-
|
100 |
-
# import matplotlib.pyplot as plt
|
101 |
-
# import numpy as np
|
102 |
-
# import pandas as pd
|
103 |
-
|
104 |
-
# import gradio as gr
|
105 |
-
# import matplotlib
|
106 |
-
|
107 |
-
# matplotlib.use('Agg')
|
108 |
-
|
109 |
-
|
110 |
-
# iaudio = gr.inputs.Audio(source="upload", type="file", label=None)
|
111 |
-
|
112 |
-
# def sales_projections(employee_data):
|
113 |
-
# sales_data = employee_data.iloc[:, 1:4].astype("int").to_numpy()
|
114 |
-
# regression_values = np.apply_along_axis(
|
115 |
-
# lambda row: np.array(np.poly1d(np.polyfit([0, 1, 2], row, 2))), 0, sales_data
|
116 |
-
# )
|
117 |
-
# projected_months = np.repeat(
|
118 |
-
# np.expand_dims(np.arange(3, 12), 0), len(sales_data), axis=0
|
119 |
-
# )
|
120 |
-
# projected_values = np.array(
|
121 |
-
# [
|
122 |
-
# month * month * regression[0] + month * regression[1] + regression[2]
|
123 |
-
# for month, regression in zip(projected_months, regression_values)
|
124 |
-
# ]
|
125 |
-
# )
|
126 |
-
# # x = [1, 2, 3]
|
127 |
-
# # y = np.array([[1, 2], [3, 4], [5, 6]])
|
128 |
-
# # plt.plot(x, y)
|
129 |
-
# #plt.plot(projected_values.T)
|
130 |
-
# #plt.legend(employee_data["Name"])
|
131 |
-
# return employee_data, get_plot(1), regression_values
|
132 |
-
|
133 |
-
|
134 |
-
# iface = gr.Interface(
|
135 |
-
# get_plot,
|
136 |
-
# iaudio,
|
137 |
-
# ["plot"],
|
138 |
-
# description="Enter sales figures for employees to predict sales trajectory over year.",
|
139 |
-
# )
|
140 |
-
# iface.launch()
|
|
|
41 |
|
42 |
logging.info(f"TS audio {os.path.basename(in_filename)} = {ts}")
|
43 |
return ts, chunks
|
44 |
+
|
|
|
|
|
|
|
|
|
|
|
45 |
|
46 |
def get_audio_plot(filename, chunks):
|
47 |
fig, ax = plt.subplots()
|
|
|
65 |
plt.xlabel('Time [s]')
|
66 |
plt.ylabel('Amplitude')
|
67 |
plt.title(os.path.basename(filename))
|
68 |
+
|
|
|
69 |
return plt.gcf()
|
70 |
+
|
71 |
|
72 |
def get_audio_info(audio):
|
73 |
ts, chunks = get_chunk_times(audio.name, 30, 1)
|
|
|
89 |
description="Enter .WAV audio to view silence areas",
|
90 |
)
|
91 |
|
92 |
+
iface.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|