jlopez00 commited on
Commit
b3385db
1 Parent(s): bbf5262

Upload folder using huggingface_hub

Browse files
.vscode/launch.json CHANGED
@@ -20,6 +20,7 @@
20
  "program": "tts_service/app.py",
21
  "args": ["--open"],
22
  "console": "integratedTerminal",
 
23
  "justMyCode": false
24
  }
25
  ]
 
20
  "program": "tts_service/app.py",
21
  "args": ["--open"],
22
  "console": "integratedTerminal",
23
+ "envFile": "${workspaceFolder}/.env",
24
  "justMyCode": false
25
  }
26
  ]
logging.yml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ version: 1
2
+ formatters:
3
+ simple:
4
+ format: '%(asctime)s %(levelname)s %(name)s - %(message)s'
5
+ handlers:
6
+ console:
7
+ class: logging.StreamHandler
8
+ level: DEBUG
9
+ formatter: simple
10
+ stream: ext://sys.stdout
11
+ loggers:
12
+ tts_service:
13
+ level: INFO
14
+ handlers: [console]
15
+ propagate: no
16
+ root:
17
+ level: WARNING
18
+ handlers: [console]
notebooks/articles/sample-2.mp3 ADDED
Binary file (149 kB). View file
 
notebooks/articles/sample-2.srt ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ WEBVTT
2
+
3
+ 00:00:00.087 --> 00:00:00.750
4
+ Thanksgiving
5
+
6
+ 00:00:00.762 --> 00:00:00.838
7
+ in
8
+
9
+ 00:00:00.850 --> 00:00:01.450
10
+ America
11
+
12
+ 00:00:01.462 --> 00:00:02.413
13
+ 2024
14
+
15
+ 00:00:02.938 --> 00:00:03.325
16
+ Social
17
+
18
+ 00:00:03.337 --> 00:00:03.975
19
+ devastation
20
+
21
+ 00:00:03.987 --> 00:00:04.100
22
+ for
23
+
24
+ 00:00:04.112 --> 00:00:04.213
25
+ the
26
+
27
+ 00:00:04.225 --> 00:00:04.600
28
+ working
29
+
30
+ 00:00:04.612 --> 00:00:05.112
31
+ class
32
+
33
+ 00:00:05.412 --> 00:00:05.875
34
+ billions
35
+
36
+ 00:00:05.888 --> 00:00:06.162
37
+ more
38
+
39
+ 00:00:06.175 --> 00:00:06.300
40
+ for
41
+
42
+ 00:00:06.312 --> 00:00:06.400
43
+ the
44
+
45
+ 00:00:06.412 --> 00:00:07.125
46
+ oligarchs
47
+
48
+ 00:00:07.537 --> 00:00:07.662
49
+ By
50
+
51
+ 00:00:07.675 --> 00:00:08.037
52
+ Barry
53
+
54
+ 00:00:08.050 --> 00:00:08.475
55
+ Grey
56
+
57
+ 00:00:08.875 --> 00:00:09.000
58
+ On
59
+
60
+ 00:00:09.012 --> 00:00:09.625
61
+ Thanksgiving
62
+
63
+ 00:00:09.637 --> 00:00:09.900
64
+ Day
65
+
66
+ 00:00:09.912 --> 00:00:10.887
67
+ 2024
68
+
69
+ 00:00:11.250 --> 00:00:11.350
70
+ the
71
+
72
+ 00:00:11.363 --> 00:00:11.738
73
+ broad
74
+
75
+ 00:00:11.750 --> 00:00:12.125
76
+ mass
77
+
78
+ 00:00:12.137 --> 00:00:12.213
79
+ of
80
+
81
+ 00:00:12.225 --> 00:00:12.312
82
+ the
83
+
84
+ 00:00:12.325 --> 00:00:12.787
85
+ American
86
+
87
+ 00:00:12.800 --> 00:00:13.500
88
+ population
89
+
90
+ 00:00:13.512 --> 00:00:13.738
91
+ has
92
+
93
+ 00:00:13.750 --> 00:00:14.225
94
+ precious
95
+
96
+ 00:00:14.238 --> 00:00:14.475
97
+ little
98
+
99
+ 00:00:14.488 --> 00:00:14.550
100
+ to
101
+
102
+ 00:00:14.562 --> 00:00:14.700
103
+ be
104
+
105
+ 00:00:14.713 --> 00:00:15.188
106
+ thankful
107
+
108
+ 00:00:15.200 --> 00:00:15.625
109
+ for
110
+
111
+ 00:00:16.025 --> 00:00:16.488
112
+ Inflated
113
+
114
+ 00:00:16.500 --> 00:00:16.850
115
+ costs
116
+
117
+ 00:00:16.863 --> 00:00:17.050
118
+ for
119
+
120
+ 00:00:17.062 --> 00:00:17.212
121
+ all
122
+
123
+ 00:00:17.225 --> 00:00:17.925
124
+ necessities
125
+
126
+ 00:00:18.238 --> 00:00:18.700
127
+ housing
128
+
129
+ 00:00:18.988 --> 00:00:19.375
130
+ food
131
+
132
+ 00:00:19.788 --> 00:00:20.363
133
+ healthcare
134
+
135
+ 00:00:20.675 --> 00:00:21.325
136
+ childcare
137
+
138
+ 00:00:21.550 --> 00:00:22.188
139
+ transport
140
+
141
+ 00:00:22.438 --> 00:00:22.863
142
+ continue
143
+
144
+ 00:00:22.875 --> 00:00:22.962
145
+ to
146
+
147
+ 00:00:22.975 --> 00:00:23.150
148
+ weigh
149
+
150
+ 00:00:23.163 --> 00:00:23.312
151
+ on
152
+
153
+ 00:00:23.325 --> 00:00:23.625
154
+ working
155
+
156
+ 00:00:23.637 --> 00:00:23.925
157
+ class
158
+
159
+ 00:00:23.938 --> 00:00:24.500
160
+ families
161
+
notebooks/articles/sample.mp3 ADDED
Binary file (159 kB). View file
 
notebooks/articles/sample.srt ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ WEBVTT
2
+
3
+ 00:00:00.087 --> 00:00:00.762
4
+ Thanksgiving
5
+
6
+ 00:00:00.775 --> 00:00:00.850
7
+ in
8
+
9
+ 00:00:00.863 --> 00:00:01.450
10
+ America
11
+
12
+ 00:00:01.462 --> 00:00:02.438
13
+ 2024
14
+
15
+ 00:00:02.975 --> 00:00:03.350
16
+ Social
17
+
18
+ 00:00:03.362 --> 00:00:04.013
19
+ devastation
20
+
21
+ 00:00:04.025 --> 00:00:04.138
22
+ for
23
+
24
+ 00:00:04.150 --> 00:00:04.250
25
+ the
26
+
27
+ 00:00:04.263 --> 00:00:04.650
28
+ working
29
+
30
+ 00:00:04.662 --> 00:00:05.162
31
+ class
32
+
33
+ 00:00:05.475 --> 00:00:05.938
34
+ billions
35
+
36
+ 00:00:05.950 --> 00:00:06.225
37
+ more
38
+
39
+ 00:00:06.237 --> 00:00:06.362
40
+ for
41
+
42
+ 00:00:06.375 --> 00:00:06.475
43
+ the
44
+
45
+ 00:00:06.487 --> 00:00:07.200
46
+ oligarchs
47
+
48
+ 00:00:07.612 --> 00:00:07.750
49
+ By
50
+
51
+ 00:00:07.763 --> 00:00:08.113
52
+ Barry
53
+
54
+ 00:00:08.125 --> 00:00:08.550
55
+ Grey
56
+
57
+ 00:00:08.950 --> 00:00:09.075
58
+ On
59
+
60
+ 00:00:09.088 --> 00:00:09.700
61
+ Thanksgiving
62
+
63
+ 00:00:09.713 --> 00:00:09.975
64
+ Day
65
+
66
+ 00:00:09.988 --> 00:00:10.963
67
+ 2024
68
+
69
+ 00:00:11.325 --> 00:00:11.425
70
+ the
71
+
72
+ 00:00:11.438 --> 00:00:11.812
73
+ broad
74
+
75
+ 00:00:11.825 --> 00:00:12.200
76
+ mass
77
+
78
+ 00:00:12.213 --> 00:00:12.287
79
+ of
80
+
81
+ 00:00:12.300 --> 00:00:12.387
82
+ the
83
+
84
+ 00:00:12.400 --> 00:00:12.863
85
+ American
86
+
87
+ 00:00:12.875 --> 00:00:13.575
88
+ population
89
+
90
+ 00:00:13.588 --> 00:00:13.812
91
+ has
92
+
93
+ 00:00:13.825 --> 00:00:14.300
94
+ precious
95
+
96
+ 00:00:14.312 --> 00:00:14.550
97
+ little
98
+
99
+ 00:00:14.562 --> 00:00:14.625
100
+ to
101
+
102
+ 00:00:14.637 --> 00:00:14.775
103
+ be
104
+
105
+ 00:00:14.787 --> 00:00:15.262
106
+ thankful
107
+
108
+ 00:00:15.275 --> 00:00:15.700
109
+ for
110
+
111
+ 00:00:16.100 --> 00:00:16.562
112
+ Inflated
113
+
114
+ 00:00:16.575 --> 00:00:16.925
115
+ costs
116
+
117
+ 00:00:16.938 --> 00:00:17.125
118
+ for
119
+
120
+ 00:00:17.137 --> 00:00:17.288
121
+ all
122
+
123
+ 00:00:17.300 --> 00:00:18.000
124
+ necessities
125
+
126
+ 00:00:18.312 --> 00:00:18.775
127
+ housing
128
+
129
+ 00:00:19.062 --> 00:00:19.450
130
+ food
131
+
132
+ 00:00:19.863 --> 00:00:20.438
133
+ healthcare
134
+
135
+ 00:00:20.750 --> 00:00:21.400
136
+ childcare
137
+
138
+ 00:00:21.625 --> 00:00:22.262
139
+ transport
140
+
141
+ 00:00:22.512 --> 00:00:22.938
142
+ continue
143
+
144
+ 00:00:22.950 --> 00:00:23.038
145
+ to
146
+
147
+ 00:00:23.050 --> 00:00:23.225
148
+ weigh
149
+
150
+ 00:00:23.238 --> 00:00:23.387
151
+ on
152
+
153
+ 00:00:23.400 --> 00:00:23.700
154
+ working
155
+
156
+ 00:00:23.712 --> 00:00:24.000
157
+ class
158
+
159
+ 00:00:24.012 --> 00:00:24.575
160
+ families
161
+
notebooks/articles/sample.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ # Thanksgiving in America 2024: Social devastation for the working class, billions more for the oligarchs.
2
+
3
+ ## By Barry Grey.
4
+
5
+ On Thanksgiving Day 2024, the broad mass of the American population has precious little to be thankful for. Inflated costs for all necessities—housing, food, healthcare, childcare, transport—continue to weigh on working class families.
notebooks/articles/slci-n28.html ADDED
@@ -0,0 +1 @@
 
 
1
+ <p>On Thanksgiving Day 2024, the broad mass of the American population has precious little to be thankful for. Inflated costs for all necessities—housing, food, healthcare, childcare, transport—continue to weigh on working class families. Workers are struggling to scrape together turkey dinners for their families and friends under conditions where the cost of a Thanksgiving meal is up 19 percent from pre-pandemic 2019, according to the American Farm Bureau Federation.</p><placeholder type="media" link="workspace://SpacesStore/3e30b341-71f3-4c36-9233-c61c84aadffd" caption="" usecaption="false"><p></p></placeholder><p>But there is an entirely different reality in the environs of the rich and the super-rich. Champagne glasses are clinking on Wall Street, at Donald Trump’s Mar-a-Lago estate, at the White House and on Capitol Hill as the stock market booms and the bonanza reaped by America’s oligarchs and their political servants under Joe Biden is set to be massively amplified under the incoming Trump administration.</p><p>Outgoing President Biden is spending his holiday at the Nantucket home of David Rubenstein, billionaire co-founder of the Carlyle Group. Defeated presidential candidate Kamala Harris is sunning herself in Hawaii. Most of their voters, and most of Trump’s, are struggling simply to get by.</p><placeholder type="media" link="workspace://SpacesStore/ecbc31ef-0c60-4801-aa23-94881b78ed75" caption="" usecaption="false"><p></p></placeholder><p>The ranks of America’s billionaires grew to 800 under Biden and their collective wealth increased by 62 percent to more than $6.2 trillion (not counting the additional hundreds of billions amassed in the stock market surge since the election of Trump). As of December of last year, the top 1 percent of Americans took 21 percent of all personal incomes, more than double the share of the bottom 50 percent. The top one percent of Americans owned 35 percent of all personal wealth and the top 10 percent owned 71 percent, while the bottom 50 percent owned just 1 percent.</p><p>In less than eight weeks, Trump’s cabal of billionaires, fascists and quacks is set to take office. It will seek to impose an agenda of mass deportations and state repression, escalation of war and genocide, further tax cuts for the rich, the ripping up of what remains of the social safety net, the dismantling of public health and public education, and the lifting of virtually all regulations on big business. Things could not appear rosier for the financial parasites who control both parties and the entire political system.</p><p>Elon Musk, Trump’s crony and the richest man in the world, with a fortune of $300 billion and counting, will be joined by fellow billionaire Vivek Ramaswamy at the head of Trump’s new Department of Government Efficiency, where they plan to cut the federal budget by $2 trillion. This will mean the gutting of Medicare, Medicaid and Social Security and the firing of hundreds of thousands of government workers.</p><placeholder type="media" link="workspace://SpacesStore/fc2d9e86-3aa0-46ea-ba9a-ee36a205513e" caption="" usecaption="false"><p></p></placeholder><p>This is on top of an already unfolding social disaster for the masses. Almost 40 percent of Americans, in a survey by the Harris Poll for Bloomberg News in December of 2023, said their household recently relied on extra money besides their regular income<strong><em> </em></strong>to make ends meet. Of those, 38 percent said the additional amounts barely covered their monthly expenses with nothing left over, and 23 per cent said it wasn’t enough to pay their bills.</p><p>Since last December, mass layoffs in auto, aerospace, retail and other sectors have continued to spread, further devastating working class families. These conditions have already sparked a wave of strikes—at Boeing, on the docks, in the auto sector—in which workers rebelled against the union bureaucrats and voted down sellout contracts.</p><p>Here are some key indices of the social reality confronting broad layers of the American people on Thanksgiving Day:</p><h4>Hunger</h4><ul><li>According to the most recent Census Bureau Household Pulse Survey (October 2023), one out of every eight American adults is struggling to afford enough food. Nearly 28 million adults nationwide—12.5 percent of the adult population—are living in homes where there is either sometimes or often not enough to eat. This is the highest that figure has reached since the first year of the COVID-19 pandemic.</li></ul><h4>Homelessness</h4><p>The “State of Homelessness” document of the National Alliance to End Homelessness, 2024 edition, reports:</p><ul><li>In 2023, the year-over-year increase in the number of people experiencing homelessness was 12.1 percent, the biggest increase since data collection began in 2007.</li><li>From 2022 to 2023, homelessness for entire families increased by 15.5 percent.</li><li>More people than ever are experiencing homelessness for the first time.<strong> </strong>From 2019 to 2023, the number of people who entered emergency shelter for the first time increased more than 23 percent. Over the course of 2023, nearly one million people experienced homelessness for the first time.</li><li>Severe housing cost burdens are on the rise. The number of renter households paying more than 50 percent of their income on rent increased dramatically, rising over 12.6 percent between 2015 and 2022.</li><li>More than half of people experiencing sheltered homelessness, and slightly less than half of people experiencing unsheltered homelessness are formally employed.</li></ul><h4>Poverty</h4><ul><li>According to the Organization for Economic Cooperation and Development (OECD), the United States has the highest poverty rate among the world’s 26 most developed countries. The United Nations Children’s Fund (UNICEF) ranks the United States second behind Mexico on a scale of what economists call “relative child poverty” when measured against 35 of the world’s richest nations.</li><li>In 2023, the official US poverty rate, according to the United States Census Bureau, was 11.1 percent. There were 36.8 million people in poverty in 2023. </li></ul><h4>Life expectancy</h4><ul><li>Overall life expectancy in the US was 76.4 years as of early 2023, the lowest in over 20 years.</li></ul><p>How is this possible in the richest country in the world? The answer is capitalism. This is a system in which the working class, which produces all of the wealth, is systematically robbed of the vast portion of what it produces on the basis of private ownership of the means of production, production for profit, and the historically outmoded nation-state framework of economic life.<strong> </strong></p><p>The levels of oligarchic excess and parasitism in the US are particularly grotesque due to the complete political subordination of the working class to the ruling elite by means of the two-party system. The exclusion of the working class from political life is enforced by the union bureaucracy and its pseudo-left hangers on in such pro-Democratic groups as the Democratic Socialists of America (DSA).</p><p>This is reflected in such facts as a federal minimum wage that remains at $7.25 an hour, not even sufficient to sustain human life. Meanwhile, the two-party monopoly spends a trillion dollars a year on war and the military and a trillion a year to service a national debt of $34 trillion and rising. The latter payouts, which directly enrich the banks and hedge funds, are on top of a combined $12 trillion doled out to rescue the financial elite in the Wall Street crises of 2008 and 2020.</p><p>The millions of workers who voted for Trump did so as a protest against the undisguised indifference of Biden and Harris to the devastating impact of inflation and austerity, including the purging of 40 million people from the Medicaid rolls. They did not vote for dictatorship, the rounding up of immigrant workers in concentration camps policed by the military for summary deportation, the expansion of US imperialism’s global war to China, an increase in Washington’s support for the genocide in Gaza, or the destruction of millions more jobs and basic social services.</p><p>They will be stunned and enraged by what is coming under Trump, and they will resist, massively and on a revolutionary scale. Leon Trotsky in his monumental <em>History of the Russian Revolution </em>devoted a chapter to “The Tzar and the Tzarina,” in which he wrote of the cognitive blindness that seems to possess ruling classes on the eve of revolutionary upheavals. He wrote:</p><blockquote><p>To that historic flood which was rolling its billows each one closer to the gates of his palace, the last Romanov opposed only a dumb indifference. It seemed as though between his consciousness and his epoch there stood some transparent but absolutely impenetrable medium.</p></blockquote><p>Trotsky continued:</p><blockquote><p>The tzar had no need of narcotics: the fatal “dope” was in his blood. Its symptoms merely seemed especially striking on the background of those great events of war and domestic crisis which led up to the revolution.</p></blockquote><p>The American ruling class is facing a historical reckoning. The social force that alone can stop and reverse the slide to fascism and world war is the working class, in the US and internationally. It will fight, but it requires a scientific Marxist and internationalist perspective and strategy and the building of a new leadership, which can be accomplished only by the Trotskyist movement, the Socialist Equality Party and the International Committee of the Fourth International. To all those who see the dangers and want to fight, we say join the SEP and take up the fight for the political independence of the working class and socialism!</p>
notebooks/articles/slci-n28.md ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ On Thanksgiving Day 2024, the broad mass of the American population has precious little to be thankful for. Inflated costs for all necessities—housing, food, healthcare, childcare, transport—continue to weigh on working class families. Workers are struggling to scrape together turkey dinners for their families and friends under conditions where the cost of a Thanksgiving meal is up 19 percent from pre-pandemic 2019, according to the American Farm Bureau Federation.
2
+
3
+ But there is an entirely different reality in the environs of the rich and the super-rich. Champagne glasses are clinking on Wall Street, at Donald Trump’s Mar-a-Lago estate, at the White House and on Capitol Hill as the stock market booms and the bonanza reaped by America’s oligarchs and their political servants under Joe Biden is set to be massively amplified under the incoming Trump administration.
4
+
5
+ Outgoing President Biden is spending his holiday at the Nantucket home of David Rubenstein, billionaire co-founder of the Carlyle Group. Defeated presidential candidate Kamala Harris is sunning herself in Hawaii. Most of their voters, and most of Trump’s, are struggling simply to get by.
6
+
7
+ The ranks of America’s billionaires grew to 800 under Biden and their collective wealth increased by 62 percent to more than \$6.2 trillion (not counting the additional hundreds of billions amassed in the stock market surge since the election of Trump). As of December of last year, the top 1 percent of Americans took 21 percent of all personal incomes, more than double the share of the bottom 50 percent. The top one percent of Americans owned 35 percent of all personal wealth and the top 10 percent owned 71 percent, while the bottom 50 percent owned just 1 percent.
8
+
9
+ In less than eight weeks, Trump’s cabal of billionaires, fascists and quacks is set to take office. It will seek to impose an agenda of mass deportations and state repression, escalation of war and genocide, further tax cuts for the rich, the ripping up of what remains of the social safety net, the dismantling of public health and public education, and the lifting of virtually all regulations on big business. Things could not appear rosier for the financial parasites who control both parties and the entire political system.
10
+
11
+ Elon Musk, Trump’s crony and the richest man in the world, with a fortune of \$300 billion and counting, will be joined by fellow billionaire Vivek Ramaswamy at the head of Trump’s new Department of Government Efficiency, where they plan to cut the federal budget by \$2 trillion. This will mean the gutting of Medicare, Medicaid and Social Security and the firing of hundreds of thousands of government workers.
12
+
13
+ This is on top of an already unfolding social disaster for the masses. Almost 40 percent of Americans, in a survey by the Harris Poll for Bloomberg News in December of 2023, said their household recently relied on extra money besides their regular income **** to make ends meet. Of those, 38 percent said the additional amounts barely covered their monthly expenses with nothing left over, and 23 per cent said it wasn’t enough to pay their bills.
14
+
15
+ Since last December, mass layoffs in auto, aerospace, retail and other sectors have continued to spread, further devastating working class families. These conditions have already sparked a wave of strikes—at Boeing, on the docks, in the auto sector—in which workers rebelled against the union bureaucrats and voted down sellout contracts.
16
+
17
+ Here are some key indices of the social reality confronting broad layers of the American people on Thanksgiving Day:
18
+
19
+ #### Hunger
20
+
21
+ - According to the most recent Census Bureau Household Pulse Survey (October 2023), one out of every eight American adults is struggling to afford enough food. Nearly 28 million adults nationwide—12.5 percent of the adult population—are living in homes where there is either sometimes or often not enough to eat. This is the highest that figure has reached since the first year of the COVID-19 pandemic.
22
+
23
+ #### Homelessness
24
+
25
+ The “State of Homelessness” document of the National Alliance to End Homelessness, 2024 edition, reports:
26
+
27
+ - In 2023, the year-over-year increase in the number of people experiencing homelessness was 12.1 percent, the biggest increase since data collection began in 2007.
28
+ - From 2022 to 2023, homelessness for entire families increased by 15.5 percent.
29
+ - More people than ever are experiencing homelessness for the first time. From 2019 to 2023, the number of people who entered emergency shelter for the first time increased more than 23 percent. Over the course of 2023, nearly one million people experienced homelessness for the first time.
30
+ - Severe housing cost burdens are on the rise. The number of renter households paying more than 50 percent of their income on rent increased dramatically, rising over 12.6 percent between 2015 and 2022.
31
+ - More than half of people experiencing sheltered homelessness, and slightly less than half of people experiencing unsheltered homelessness are formally employed.
32
+
33
+ #### Poverty
34
+
35
+ - According to the Organization for Economic Cooperation and Development (OECD), the United States has the highest poverty rate among the world’s 26 most developed countries. The United Nations Children’s Fund (UNICEF) ranks the United States second behind Mexico on a scale of what economists call “relative child poverty” when measured against 35 of the world’s richest nations.
36
+ - In 2023, the official US poverty rate, according to the United States Census Bureau, was 11.1 percent. There were 36.8 million people in poverty in 2023.
37
+
38
+ #### Life expectancy
39
+
40
+ - Overall life expectancy in the US was 76.4 years as of early 2023, the lowest in over 20 years.
41
+
42
+ How is this possible in the richest country in the world? The answer is capitalism. This is a system in which the working class, which produces all of the wealth, is systematically robbed of the vast portion of what it produces on the basis of private ownership of the means of production, production for profit, and the historically outmoded nation-state framework of economic life.
43
+
44
+ The levels of oligarchic excess and parasitism in the US are particularly grotesque due to the complete political subordination of the working class to the ruling elite by means of the two-party system. The exclusion of the working class from political life is enforced by the union bureaucracy and its pseudo-left hangers on in such pro-Democratic groups as the Democratic Socialists of America (DSA).
45
+
46
+ This is reflected in such facts as a federal minimum wage that remains at \$7.25 an hour, not even sufficient to sustain human life. Meanwhile, the two-party monopoly spends a trillion dollars a year on war and the military and a trillion a year to service a national debt of \$34 trillion and rising. The latter payouts, which directly enrich the banks and hedge funds, are on top of a combined \$12 trillion doled out to rescue the financial elite in the Wall Street crises of 2008 and 2020.
47
+
48
+ The millions of workers who voted for Trump did so as a protest against the undisguised indifference of Biden and Harris to the devastating impact of inflation and austerity, including the purging of 40 million people from the Medicaid rolls. They did not vote for dictatorship, the rounding up of immigrant workers in concentration camps policed by the military for summary deportation, the expansion of US imperialism’s global war to China, an increase in Washington’s support for the genocide in Gaza, or the destruction of millions more jobs and basic social services.
49
+
50
+ They will be stunned and enraged by what is coming under Trump, and they will resist, massively and on a revolutionary scale. Leon Trotsky in his monumental *History of the Russian Revolution* devoted a chapter to “The Tzar and the Tzarina,” in which he wrote of the cognitive blindness that seems to possess ruling classes on the eve of revolutionary upheavals. He wrote:
51
+
52
+ > To that historic flood which was rolling its billows each one closer to the gates of his palace, the last Romanov opposed only a dumb indifference. It seemed as though between his consciousness and his epoch there stood some transparent but absolutely impenetrable medium.
53
+
54
+ Trotsky continued:
55
+
56
+ > The tzar had no need of narcotics: the fatal “dope” was in his blood. Its symptoms merely seemed especially striking on the background of those great events of war and domestic crisis which led up to the revolution.
57
+
58
+ The American ruling class is facing a historical reckoning. The social force that alone can stop and reverse the slide to fascism and world war is the working class, in the US and internationally. It will fight, but it requires a scientific Marxist and internationalist perspective and strategy and the building of a new leadership, which can be accomplished only by the Trotskyist movement, the Socialist Equality Party and the International Committee of the Fourth International. To all those who see the dangers and want to fight, we say join the SEP and take up the fight for the political independence of the working class and socialism!
notebooks/articles/slci-n28.txt ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ On Thanksgiving Day 2024, the broad mass of the American population has precious little to be thankful for. Inflated costs for all necessities—housing, food, healthcare, childcare, transport—continue to weigh on working class families. Workers are struggling to scrape together turkey dinners for their families and friends under conditions where the cost of a Thanksgiving meal is up 19 percent from pre-pandemic 2019, according to the American Farm Bureau Federation.
2
+
3
+ But there is an entirely different reality in the environs of the rich and the super-rich. Champagne glasses are clinking on Wall Street, at Donald Trump’s Mar-a-Lago estate, at the White House and on Capitol Hill as the stock market booms and the bonanza reaped by America’s oligarchs and their political servants under Joe Biden is set to be massively amplified under the incoming Trump administration.
4
+
5
+ Outgoing President Biden is spending his holiday at the Nantucket home of David Rubenstein, billionaire co-founder of the Carlyle Group. Defeated presidential candidate Kamala Harris is sunning herself in Hawaii. Most of their voters, and most of Trump’s, are struggling simply to get by.
6
+
7
+ The ranks of America’s billionaires grew to 800 under Biden and their collective wealth increased by 62 percent to more than $6.2 trillion (not counting the additional hundreds of billions amassed in the stock market surge since the election of Trump). As of December of last year, the top 1 percent of Americans took 21 percent of all personal incomes, more than double the share of the bottom 50 percent. The top one percent of Americans owned 35 percent of all personal wealth and the top 10 percent owned 71 percent, while the bottom 50 percent owned just 1 percent.
8
+
9
+ In less than eight weeks, Trump’s cabal of billionaires, fascists and quacks is set to take office. It will seek to impose an agenda of mass deportations and state repression, escalation of war and genocide, further tax cuts for the rich, the ripping up of what remains of the social safety net, the dismantling of public health and public education, and the lifting of virtually all regulations on big business. Things could not appear rosier for the financial parasites who control both parties and the entire political system.
10
+
11
+ Elon Musk, Trump’s crony and the richest man in the world, with a fortune of $300 billion and counting, will be joined by fellow billionaire Vivek Ramaswamy at the head of Trump’s new Department of Government Efficiency, where they plan to cut the federal budget by $2 trillion. This will mean the gutting of Medicare, Medicaid and Social Security and the firing of hundreds of thousands of government workers.
12
+
13
+ This is on top of an already unfolding social disaster for the masses. Almost 40 percent of Americans, in a survey by the Harris Poll for Bloomberg News in December of 2023, said their household recently relied on extra money besides their regular income to make ends meet. Of those, 38 percent said the additional amounts barely covered their monthly expenses with nothing left over, and 23 per cent said it wasn’t enough to pay their bills.
14
+
15
+ Since last December, mass layoffs in auto, aerospace, retail and other sectors have continued to spread, further devastating working class families. These conditions have already sparked a wave of strikes—at Boeing, on the docks, in the auto sector—in which workers rebelled against the union bureaucrats and voted down sellout contracts.
16
+
17
+ Here are some key indices of the social reality confronting broad layers of the American people on Thanksgiving Day:
18
+
19
+ Hunger
20
+
21
+ - According to the most recent Census Bureau Household Pulse Survey (October 2023), one out of every eight American adults is struggling to afford enough food. Nearly 28 million adults nationwide—12.5 percent of the adult population—are living in homes where there is either sometimes or often not enough to eat. This is the highest that figure has reached since the first year of the COVID-19 pandemic.
22
+
23
+ Homelessness
24
+
25
+ The “State of Homelessness” document of the National Alliance to End Homelessness, 2024 edition, reports:
26
+
27
+ - In 2023, the year-over-year increase in the number of people experiencing homelessness was 12.1 percent, the biggest increase since data collection began in 2007.
28
+ - From 2022 to 2023, homelessness for entire families increased by 15.5 percent.
29
+ - More people than ever are experiencing homelessness for the first time. From 2019 to 2023, the number of people who entered emergency shelter for the first time increased more than 23 percent. Over the course of 2023, nearly one million people experienced homelessness for the first time.
30
+ - Severe housing cost burdens are on the rise. The number of renter households paying more than 50 percent of their income on rent increased dramatically, rising over 12.6 percent between 2015 and 2022.
31
+ - More than half of people experiencing sheltered homelessness, and slightly less than half of people experiencing unsheltered homelessness are formally employed.
32
+
33
+ Poverty
34
+
35
+ - According to the Organization for Economic Cooperation and Development (OECD), the United States has the highest poverty rate among the world’s 26 most developed countries. The United Nations Children’s Fund (UNICEF) ranks the United States second behind Mexico on a scale of what economists call “relative child poverty” when measured against 35 of the world’s richest nations.
36
+ - In 2023, the official US poverty rate, according to the United States Census Bureau, was 11.1 percent. There were 36.8 million people in poverty in 2023.
37
+
38
+ Life expectancy
39
+
40
+ - Overall life expectancy in the US was 76.4 years as of early 2023, the lowest in over 20 years.
41
+
42
+ How is this possible in the richest country in the world? The answer is capitalism. This is a system in which the working class, which produces all of the wealth, is systematically robbed of the vast portion of what it produces on the basis of private ownership of the means of production, production for profit, and the historically outmoded nation-state framework of economic life.
43
+
44
+ The levels of oligarchic excess and parasitism in the US are particularly grotesque due to the complete political subordination of the working class to the ruling elite by means of the two-party system. The exclusion of the working class from political life is enforced by the union bureaucracy and its pseudo-left hangers on in such pro-Democratic groups as the Democratic Socialists of America (DSA).
45
+
46
+ This is reflected in such facts as a federal minimum wage that remains at $7.25 an hour, not even sufficient to sustain human life. Meanwhile, the two-party monopoly spends a trillion dollars a year on war and the military and a trillion a year to service a national debt of $34 trillion and rising. The latter payouts, which directly enrich the banks and hedge funds, are on top of a combined $12 trillion doled out to rescue the financial elite in the Wall Street crises of 2008 and 2020.
47
+
48
+ The millions of workers who voted for Trump did so as a protest against the undisguised indifference of Biden and Harris to the devastating impact of inflation and austerity, including the purging of 40 million people from the Medicaid rolls. They did not vote for dictatorship, the rounding up of immigrant workers in concentration camps policed by the military for summary deportation, the expansion of US imperialism’s global war to China, an increase in Washington’s support for the genocide in Gaza, or the destruction of millions more jobs and basic social services.
49
+
50
+ They will be stunned and enraged by what is coming under Trump, and they will resist, massively and on a revolutionary scale. Leon Trotsky in his monumental History of the Russian Revolution devoted a chapter to “The Tzar and the Tzarina,” in which he wrote of the cognitive blindness that seems to possess ruling classes on the eve of revolutionary upheavals. He wrote:
51
+
52
+ To that historic flood which was rolling its billows each one closer to the gates of his palace, the last Romanov opposed only a dumb indifference. It seemed as though between his consciousness and his epoch there stood some transparent but absolutely impenetrable medium.
53
+
54
+ Trotsky continued:
55
+
56
+ The tzar had no need of narcotics: the fatal “dope” was in his blood. Its symptoms merely seemed especially striking on the background of those great events of war and domestic crisis which led up to the revolution.
57
+
58
+ The American ruling class is facing a historical reckoning. The social force that alone can stop and reverse the slide to fascism and world war is the working class, in the US and internationally. It will fight, but it requires a scientific Marxist and internationalist perspective and strategy and the building of a new leadership, which can be accomplished only by the Trotskyist movement, the Socialist Equality Party and the International Committee of the Fourth International. To all those who see the dangers and want to fight, we say join the SEP and take up the fight for the political independence of the working class and socialism!
notebooks/couchdb.http ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @url = {{$dotenv COUCHDB_URL}}
2
+ @user = {{$dotenv COUCHDB_USER}}
3
+ @password = {{$dotenv COUCHDB_PASSWORD}}
4
+ @db = {{$dotenv COUCHDB_DB}}
5
+ @origin = 0
6
+ @origin = 316723-g1AAAACReJzLYWBgYMpgTmHgzcvPy09JdcjLz8gvLskBCScyJNX___8_K4M5iYEpWyEXKMaekpyabGBuiK4ehwl5LECSoQFI_YcblCUMNsgsMS010dQSXVsWAD8FLCA
7
+ @batchSize = 10
8
+ @includeDocs = true
9
+ @authHeader = Authorization: Basic {{user}}:{{password}}
10
+
11
+ ###
12
+ # @name session
13
+ POST {{url}}/_session
14
+ Content-Type: application/json
15
+
16
+ {
17
+ "name": "{{user}}",
18
+ "password": "{{password}}"
19
+ }
20
+
21
+ ###
22
+ # @name docById
23
+ @id = b7fdc644-5b24-40ae-b489-37b3fc0c5541
24
+ GET {{url}}/{{db}}/{{id}}
25
+ {{authHeader}}
26
+
27
+ ###
28
+ # @name designDocs
29
+ GET {{url}}/{{db}}/_design_docs
30
+ {{authHeader}}
31
+
32
+ ###
33
+ # @name design
34
+ GET {{url}}/{{db}}/_design/wsws/_view/by_path
35
+ ?limit=1
36
+ &key="/en/articles/2024/11/28/slci-n28.html"
37
+ &include_docs=true
38
+ {{authHeader}}
39
+
40
+ ###
41
+ # @name changes
42
+ GET {{url}}/{{db}}/_changes
43
+ ?limit={{batchSize}}
44
+ &include_docs={{includeDocs}}
45
+ &since={{origin}}
46
+
47
+ ###
48
+ # @name changes
49
+ GET {{url}}/{{db}}/_changes
50
+ ?limit={{batchSize}}
51
+ &include_docs={{includeDocs}}
52
+ &since={{changes.response.body.last_seq}}
53
+
54
+ ###
55
+ # @name broken
56
+ GET {{url}}/{{db}}/_changes
57
+ ?limit=10
58
+ &include_docs=true
59
+ &since=316731-g1AAAACReJzLYWBgYMpgTmHgzcvPy09JdcjLz8gvLskBCScyJNX___8_K4M5iYEpWyEXKMaekpyabGBuiK4ehwl5LECSoQFI_YcblCUNNsgsMS010dQSXVsWAD_1LCg
notebooks/sample.txt ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Thanksgiving in America 2024: Social devastation for the working class, billions more for the oligarchs
2
+ By Barry Grey
3
+ On Thanksgiving Day 2024, the broad mass of the American population has precious little to be thankful for. Inflated costs for all necessities---housing, food, healthcare, childcare, transport---continue to weigh on working class families. Workers are struggling to scrape together turkey dinners for their families and friends under conditions where the cost of a Thanksgiving meal is up 19 percent from pre-pandemic 2019, according to the American Farm Bureau Federation.
4
+ But there is an entirely different reality in the environs of the rich and the super-rich. Champagne glasses are clinking on Wall Street, at Donald Trump's Mar-a-Lago estate, at the White House and on Capitol Hill as the stock market booms and the bonanza reaped by America's oligarchs and their political servants under Joe Biden is set to be massively amplified under the incoming Trump administration.
5
+ Outgoing President Biden is spending his holiday at the Nantucket home of David Rubenstein, billionaire co-founder of the Carlyle Group. Defeated presidential candidate Kamala Harris is sunning herself in Hawaii. Most of their voters, and most of Trump's, are struggling simply to get by.
6
+ The ranks of America's billionaires grew to 800 under Biden and their collective wealth increased by 62 percent to more than $6.2 trillion (not counting the additional hundreds of billions amassed in the stock market surge since the election of Trump). As of December of last year, the top 1 percent of Americans took 21 percent of all personal incomes, more than double the share of the bottom 50 percent. The top one percent of Americans owned 35 percent of all personal wealth and the top 10 percent owned 71 percent, while the bottom 50 percent owned just 1 percent.
7
+ In less than eight weeks, Trump's cabal of billionaires, fascists and quacks is set to take office. It will seek to impose an agenda of mass deportations and state repression, escalation of war and genocide, further tax cuts for the rich, the ripping up of what remains of the social safety net, the dismantling of public health and public education, and the lifting of virtually all regulations on big business. Things could not appear rosier for the financial parasites who control both parties and the entire political system.
8
+ Elon Musk, Trump's crony and the richest man in the world, with a fortune of $300 billion and counting, will be joined by fellow billionaire Vivek Ramaswamy at the head of Trump's new Department of Government Efficiency, where they plan to cut the federal budget by $2 trillion. This will mean the gutting of Medicare, Medicaid and Social Security and the firing of hundreds of thousands of government workers.
9
+ This is on top of an already unfolding social disaster for the masses. Almost 40 percent of Americans, in a survey by the Harris Poll for Bloomberg News in December of 2023, said their household recently relied on extra money besides their regular income **** to make ends meet. Of those, 38 percent said the additional amounts barely covered their monthly expenses with nothing left over, and 23 per cent said it wasn't enough to pay their bills.
10
+ Since last December, mass layoffs in auto, aerospace, retail and other sectors have continued to spread, further devastating working class families. These conditions have already sparked a wave of strikes---at Boeing, on the docks, in the auto sector---in which workers rebelled against the union bureaucrats and voted down sellout contracts.
11
+ Here are some key indices of the social reality confronting broad layers of the American people on Thanksgiving Day:
12
+ Hunger
13
+ According to the most recent Census Bureau Household Pulse Survey (October 2023), one out of every eight American adults is struggling to afford enough food. Nearly 28 million adults nationwide---12.5 percent of the adult population---are living in homes where there is either sometimes or often not enough to eat. This is the highest that figure has reached since the first year of the COVID-19 pandemic.
14
+ Homelessness
15
+ The "State of Homelessness" document of the National Alliance to End Homelessness, 2024 edition, reports:
16
+ In 2023, the year-over-year increase in the number of people experiencing homelessness was 12.1 percent, the biggest increase since data collection began in 2007.
17
+ From 2022 to 2023, homelessness for entire families increased by 15.5 percent.
18
+ More people than ever are experiencing homelessness for the first time. From 2019 to 2023, the number of people who entered emergency shelter for the first time increased more than 23 percent. Over the course of 2023, nearly one million people experienced homelessness for the first time.
19
+ Severe housing cost burdens are on the rise. The number of renter households paying more than 50 percent of their income on rent increased dramatically, rising over 12.6 percent between 2015 and 2022.
20
+ More than half of people experiencing sheltered homelessness, and slightly less than half of people experiencing unsheltered homelessness are formally employed.
21
+ Poverty
22
+ According to the Organization for Economic Cooperation and Development (OECD), the United States has the highest poverty rate among the world's 26 most developed countries. The United Nations Children's Fund (UNICEF) ranks the United States second behind Mexico on a scale of what economists call "relative child poverty" when measured against 35 of the world's richest nations.
23
+ In 2023, the official US poverty rate, according to the United States Census Bureau, was 11.1 percent. There were 36.8 million people in poverty in 2023.
24
+ Life expectancy
25
+ Overall life expectancy in the US was 76.4 years as of early 2023, the lowest in over 20 years.
26
+ How is this possible in the richest country in the world? The answer is capitalism. This is a system in which the working class, which produces all of the wealth, is systematically robbed of the vast portion of what it produces on the basis of private ownership of the means of production, production for profit, and the historically outmoded nation-state framework of economic life.
27
+ The levels of oligarchic excess and parasitism in the US are particularly grotesque due to the complete political subordination of the working class to the ruling elite by means of the two-party system. The exclusion of the working class from political life is enforced by the union bureaucracy and its pseudo-left hangers on in such pro-Democratic groups as the Democratic Socialists of America (DSA).
28
+ This is reflected in such facts as a federal minimum wage that remains at $7.25 an hour, not even sufficient to sustain human life. Meanwhile, the two-party monopoly spends a trillion dollars a year on war and the military and a trillion a year to service a national debt of $34 trillion and rising. The latter payouts, which directly enrich the banks and hedge funds, are on top of a combined $12 trillion doled out to rescue the financial elite in the Wall Street crises of 2008 and 2020.
29
+ The millions of workers who voted for Trump did so as a protest against the undisguised indifference of Biden and Harris to the devastating impact of inflation and austerity, including the purging of 40 million people from the Medicaid rolls. They did not vote for dictatorship, the rounding up of immigrant workers in concentration camps policed by the military for summary deportation, the expansion of US imperialism's global war to China, an increase in Washington's support for the genocide in Gaza, or the destruction of millions more jobs and basic social services.
30
+ They will be stunned and enraged by what is coming under Trump, and they will resist, massively and on a revolutionary scale. Leon Trotsky in his monumental History of the Russian Revolution devoted a chapter to "The Tzar and the Tzarina," in which he wrote of the cognitive blindness that seems to possess ruling classes on the eve of revolutionary upheavals. He wrote:
31
+ To that historic flood which was rolling its billows each one closer to the gates of his palace, the last Romanov opposed only a dumb indifference. It seemed as though between his consciousness and his epoch there stood some transparent but absolutely impenetrable medium.
32
+ Trotsky continued:
33
+ The tzar had no need of narcotics: the fatal "dope" was in his blood. Its symptoms merely seemed especially striking on the background of those great events of war and domestic crisis which led up to the revolution.
34
+ The American ruling class is facing a historical reckoning. The social force that alone can stop and reverse the slide to fascism and world war is the working class, in the US and internationally. It will fight, but it requires a scientific Marxist and internationalist perspective and strategy and the building of a new leadership, which can be accomplished only by the Trotskyist movement, the Socialist Equality Party and the International Committee of the Fourth International. To all those who see the dangers and want to fight, we say join the SEP and take up the fight for the political independence of the working class and socialism!
packages.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ pandoc
poetry.lock CHANGED
@@ -1847,13 +1847,13 @@ trio = ["trio (>=0.22.0,<1.0)"]
1847
 
1848
  [[package]]
1849
  name = "httpx"
1850
- version = "0.27.2"
1851
  description = "The next generation HTTP client."
1852
  optional = false
1853
  python-versions = ">=3.8"
1854
  files = [
1855
- {file = "httpx-0.27.2-py3-none-any.whl", hash = "sha256:7bb2708e112d8fdd7829cd4243970f0c223274051cb35ee80c03301ee29a3df0"},
1856
- {file = "httpx-0.27.2.tar.gz", hash = "sha256:f7c2be1d2f3c3c3160d441802406b206c2b76f5947b11115e6df10c6c65e66c2"},
1857
  ]
1858
 
1859
  [package.dependencies]
@@ -1861,7 +1861,6 @@ anyio = "*"
1861
  certifi = "*"
1862
  httpcore = "==1.*"
1863
  idna = "*"
1864
- sniffio = "*"
1865
 
1866
  [package.extras]
1867
  brotli = ["brotli", "brotlicffi"]
@@ -3420,6 +3419,20 @@ files = [
3420
  numpy = ">=1.23.5"
3421
  types-pytz = ">=2022.1.1"
3422
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3423
  [[package]]
3424
  name = "parso"
3425
  version = "0.8.4"
@@ -3676,6 +3689,37 @@ files = [
3676
  dev = ["pre-commit", "tox"]
3677
  testing = ["pytest", "pytest-benchmark"]
3678
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3679
  [[package]]
3680
  name = "pooch"
3681
  version = "1.8.2"
@@ -5731,6 +5775,17 @@ files = [
5731
  {file = "types_pytz-2024.2.0.20241003-py3-none-any.whl", hash = "sha256:3e22df1336c0c6ad1d29163c8fda82736909eb977281cb823c57f8bae07118b7"},
5732
  ]
5733
 
 
 
 
 
 
 
 
 
 
 
 
5734
  [[package]]
5735
  name = "types-regex"
5736
  version = "2024.11.6.20241108"
@@ -6139,4 +6194,4 @@ propcache = ">=0.2.0"
6139
  [metadata]
6140
  lock-version = "2.0"
6141
  python-versions = "~3.10"
6142
- content-hash = "2a4fe2c79fae82f02d2228d746aea2632d6057cdd5685673c9a765856be76291"
 
1847
 
1848
  [[package]]
1849
  name = "httpx"
1850
+ version = "0.28.0"
1851
  description = "The next generation HTTP client."
1852
  optional = false
1853
  python-versions = ">=3.8"
1854
  files = [
1855
+ {file = "httpx-0.28.0-py3-none-any.whl", hash = "sha256:dc0b419a0cfeb6e8b34e85167c0da2671206f5095f1baa9663d23bcfd6b535fc"},
1856
+ {file = "httpx-0.28.0.tar.gz", hash = "sha256:0858d3bab51ba7e386637f22a61d8ccddaeec5f3fe4209da3a6168dbb91573e0"},
1857
  ]
1858
 
1859
  [package.dependencies]
 
1861
  certifi = "*"
1862
  httpcore = "==1.*"
1863
  idna = "*"
 
1864
 
1865
  [package.extras]
1866
  brotli = ["brotli", "brotlicffi"]
 
3419
  numpy = ">=1.23.5"
3420
  types-pytz = ">=2022.1.1"
3421
 
3422
+ [[package]]
3423
+ name = "pandoc"
3424
+ version = "2.4"
3425
+ description = "Pandoc Documents for Python"
3426
+ optional = false
3427
+ python-versions = "*"
3428
+ files = [
3429
+ {file = "pandoc-2.4.tar.gz", hash = "sha256:ecd1f8cbb7f4180c6b5db4a17a7c1a74df519995f5f186ef81ce72a9cbd0dd9a"},
3430
+ ]
3431
+
3432
+ [package.dependencies]
3433
+ plumbum = "*"
3434
+ ply = "*"
3435
+
3436
  [[package]]
3437
  name = "parso"
3438
  version = "0.8.4"
 
3689
  dev = ["pre-commit", "tox"]
3690
  testing = ["pytest", "pytest-benchmark"]
3691
 
3692
+ [[package]]
3693
+ name = "plumbum"
3694
+ version = "1.9.0"
3695
+ description = "Plumbum: shell combinators library"
3696
+ optional = false
3697
+ python-versions = ">=3.8"
3698
+ files = [
3699
+ {file = "plumbum-1.9.0-py3-none-any.whl", hash = "sha256:9fd0d3b0e8d86e4b581af36edf3f3bbe9d1ae15b45b8caab28de1bcb27aaa7f5"},
3700
+ {file = "plumbum-1.9.0.tar.gz", hash = "sha256:e640062b72642c3873bd5bdc3effed75ba4d3c70ef6b6a7b907357a84d909219"},
3701
+ ]
3702
+
3703
+ [package.dependencies]
3704
+ pywin32 = {version = "*", markers = "platform_system == \"Windows\" and platform_python_implementation != \"PyPy\""}
3705
+
3706
+ [package.extras]
3707
+ dev = ["coverage[toml]", "paramiko", "psutil", "pytest (>=6.0)", "pytest-cov", "pytest-mock", "pytest-timeout"]
3708
+ docs = ["sphinx (>=4.0.0)", "sphinx-rtd-theme (>=1.0.0)"]
3709
+ ssh = ["paramiko"]
3710
+ test = ["coverage[toml]", "paramiko", "psutil", "pytest (>=6.0)", "pytest-cov", "pytest-mock", "pytest-timeout"]
3711
+
3712
+ [[package]]
3713
+ name = "ply"
3714
+ version = "3.11"
3715
+ description = "Python Lex & Yacc"
3716
+ optional = false
3717
+ python-versions = "*"
3718
+ files = [
3719
+ {file = "ply-3.11-py2.py3-none-any.whl", hash = "sha256:096f9b8350b65ebd2fd1346b12452efe5b9607f7482813ffca50c22722a807ce"},
3720
+ {file = "ply-3.11.tar.gz", hash = "sha256:00c7c1aaa88358b9c765b6d3000c6eec0ba42abca5351b095321aef446081da3"},
3721
+ ]
3722
+
3723
  [[package]]
3724
  name = "pooch"
3725
  version = "1.8.2"
 
5775
  {file = "types_pytz-2024.2.0.20241003-py3-none-any.whl", hash = "sha256:3e22df1336c0c6ad1d29163c8fda82736909eb977281cb823c57f8bae07118b7"},
5776
  ]
5777
 
5778
+ [[package]]
5779
+ name = "types-pyyaml"
5780
+ version = "6.0.12.20240917"
5781
+ description = "Typing stubs for PyYAML"
5782
+ optional = false
5783
+ python-versions = ">=3.8"
5784
+ files = [
5785
+ {file = "types-PyYAML-6.0.12.20240917.tar.gz", hash = "sha256:d1405a86f9576682234ef83bcb4e6fff7c9305c8b1fbad5e0bcd4f7dbdc9c587"},
5786
+ {file = "types_PyYAML-6.0.12.20240917-py3-none-any.whl", hash = "sha256:392b267f1c0fe6022952462bf5d6523f31e37f6cea49b14cee7ad634b6301570"},
5787
+ ]
5788
+
5789
  [[package]]
5790
  name = "types-regex"
5791
  version = "2024.11.6.20241108"
 
6194
  [metadata]
6195
  lock-version = "2.0"
6196
  python-versions = "~3.10"
6197
+ content-hash = "9aec331b8bb3a245ef2f232c85343bc8a1114e5d03679e3309882d59d617e083"
pyproject.toml CHANGED
@@ -6,7 +6,6 @@ authors = ["Jesus Lopez <jesus@jesusla.com>"]
6
  readme = "README.md"
7
  packages = [
8
  { include = "assets", from = "." },
9
- { include = "core", from = "." },
10
  { include = "rvc", from = "." },
11
  { include = "tabs", from = "." },
12
  { include = "tts_service", from = "." },
@@ -49,6 +48,9 @@ tqdm = "^4.67.1"
49
  transformers = "4.44.2"
50
  versatile-audio-upscaler = "^0.0.2"
51
  wget = "^3.2"
 
 
 
52
 
53
  [tool.poetry.group.ci.dependencies]
54
  gradio = "4.43.0"
@@ -75,6 +77,7 @@ types-boto3 = "^1.0.2"
75
  types-regex = "^2024.11.6.20241108"
76
  types-requests = "^2.32.0.20241016"
77
  types-six = "^1.16.21.20241105"
 
78
 
79
 
80
  [tool.ruff]
@@ -99,7 +102,7 @@ select = [
99
 
100
 
101
  [tool.mypy]
102
- packages = "assets,core,rvc,tabs,tts_service,tests"
103
  check_untyped_defs = true
104
  explicit_package_bases = true
105
  namespace_packages = true
@@ -150,6 +153,7 @@ module = [
150
  "local_attention",
151
  "matplotlib.*",
152
  "noisereduce",
 
153
  "pedalboard_native",
154
  "pydub",
155
  "pypresence",
 
6
  readme = "README.md"
7
  packages = [
8
  { include = "assets", from = "." },
 
9
  { include = "rvc", from = "." },
10
  { include = "tabs", from = "." },
11
  { include = "tts_service", from = "." },
 
48
  transformers = "4.44.2"
49
  versatile-audio-upscaler = "^0.0.2"
50
  wget = "^3.2"
51
+ httpx = "^0.28.0"
52
+ pandoc = "^2.4"
53
+ pyyaml = "^6.0.2"
54
 
55
  [tool.poetry.group.ci.dependencies]
56
  gradio = "4.43.0"
 
77
  types-regex = "^2024.11.6.20241108"
78
  types-requests = "^2.32.0.20241016"
79
  types-six = "^1.16.21.20241105"
80
+ types-pyyaml = "^6.0.12.20240917"
81
 
82
 
83
  [tool.ruff]
 
102
 
103
 
104
  [tool.mypy]
105
+ packages = "assets,rvc,tabs,tts_service,tests"
106
  check_untyped_defs = true
107
  explicit_package_bases = true
108
  namespace_packages = true
 
153
  "local_attention",
154
  "matplotlib.*",
155
  "noisereduce",
156
+ "pandoc",
157
  "pedalboard_native",
158
  "pydub",
159
  "pypresence",
requirements.txt CHANGED
@@ -582,9 +582,9 @@ h11==0.14.0 ; python_version >= "3.10" and python_version < "3.11" \
582
  httpcore==1.0.7 ; python_version >= "3.10" and python_version < "3.11" \
583
  --hash=sha256:8551cb62a169ec7162ac7be8d4817d561f60e08eaa485234898414bb5a8a0b4c \
584
  --hash=sha256:a3fff8f43dc260d5bd363d9f9cf1830fa3a458b332856f34282de498ed420edd
585
- httpx==0.27.2 ; python_version >= "3.10" and python_version < "3.11" \
586
- --hash=sha256:7bb2708e112d8fdd7829cd4243970f0c223274051cb35ee80c03301ee29a3df0 \
587
- --hash=sha256:f7c2be1d2f3c3c3160d441802406b206c2b76f5947b11115e6df10c6c65e66c2
588
  huggingface-hub==0.26.2 ; python_version >= "3.10" and python_version < "3.11" \
589
  --hash=sha256:98c2a5a8e786c7b2cb6fdeb2740893cba4d53e312572ed3d8afafda65b128c46 \
590
  --hash=sha256:b100d853465d965733964d123939ba287da60a547087783ddff8a323f340332b
@@ -1332,6 +1332,8 @@ pandas==2.2.3 ; python_version >= "3.10" and python_version < "3.11" \
1332
  --hash=sha256:f00d1345d84d8c86a63e476bb4955e46458b304b9575dcf71102b5c705320015 \
1333
  --hash=sha256:f3a255b2c19987fbbe62a9dfd6cff7ff2aa9ccab3fc75218fd4b7530f01efa24 \
1334
  --hash=sha256:fffb8ae78d8af97f849404f21411c95062db1496aeb3e56f146f0355c9989319
 
 
1335
  pedalboard==0.9.16 ; python_version >= "3.10" and python_version < "3.11" \
1336
  --hash=sha256:031e6833c5983c3fe0a96bc4ff04790663a9e95a01c402828bd5a4eff4b8b541 \
1337
  --hash=sha256:03e73da46d6678a8adbd1ebc70bf38e4316918e44514eb9b1d7989bfb43cb30c \
@@ -1455,6 +1457,12 @@ pillow==10.4.0 ; python_version >= "3.10" and python_version < "3.11" \
1455
  platformdirs==4.3.6 ; python_version >= "3.10" and python_version < "3.11" \
1456
  --hash=sha256:357fb2acbc885b0419afd3ce3ed34564c13c9b95c89360cd9563f73aa5e2b907 \
1457
  --hash=sha256:73e575e1408ab8103900836b97580d5307456908a03e92031bab39e4554cc3fb
 
 
 
 
 
 
1458
  pooch==1.8.2 ; python_version >= "3.10" and python_version < "3.11" \
1459
  --hash=sha256:3529a57096f7198778a5ceefd5ac3ef0e4d06a6ddaf9fc2d609b806f25302c47 \
1460
  --hash=sha256:76561f0de68a01da4df6af38e9955c4c9d1a5c90da73f7e40276a5728ec83d10
@@ -1689,6 +1697,25 @@ python-multipart==0.0.17 ; python_version >= "3.10" and python_version < "3.11"
1689
  pytz==2024.2 ; python_version >= "3.10" and python_version < "3.11" \
1690
  --hash=sha256:2aa355083c50a0f93fa581709deac0c9ad65cca8a9e9beac660adcbd493c798a \
1691
  --hash=sha256:31c7c1817eb7fae7ca4b8c7ee50c72f93aa2dd863de768e1ef4245d426aa0725
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1692
  pyyaml==6.0.2 ; python_version >= "3.10" and python_version < "3.11" \
1693
  --hash=sha256:01179a4a8559ab5de078078f37e5c1a30d76bb88519906844fd7bdea1b7729ff \
1694
  --hash=sha256:0833f8694549e586547b576dcfaba4a6b55b9e96098b36cdc7ebefe667dfed48 \
 
582
  httpcore==1.0.7 ; python_version >= "3.10" and python_version < "3.11" \
583
  --hash=sha256:8551cb62a169ec7162ac7be8d4817d561f60e08eaa485234898414bb5a8a0b4c \
584
  --hash=sha256:a3fff8f43dc260d5bd363d9f9cf1830fa3a458b332856f34282de498ed420edd
585
+ httpx==0.28.0 ; python_version >= "3.10" and python_version < "3.11" \
586
+ --hash=sha256:0858d3bab51ba7e386637f22a61d8ccddaeec5f3fe4209da3a6168dbb91573e0 \
587
+ --hash=sha256:dc0b419a0cfeb6e8b34e85167c0da2671206f5095f1baa9663d23bcfd6b535fc
588
  huggingface-hub==0.26.2 ; python_version >= "3.10" and python_version < "3.11" \
589
  --hash=sha256:98c2a5a8e786c7b2cb6fdeb2740893cba4d53e312572ed3d8afafda65b128c46 \
590
  --hash=sha256:b100d853465d965733964d123939ba287da60a547087783ddff8a323f340332b
 
1332
  --hash=sha256:f00d1345d84d8c86a63e476bb4955e46458b304b9575dcf71102b5c705320015 \
1333
  --hash=sha256:f3a255b2c19987fbbe62a9dfd6cff7ff2aa9ccab3fc75218fd4b7530f01efa24 \
1334
  --hash=sha256:fffb8ae78d8af97f849404f21411c95062db1496aeb3e56f146f0355c9989319
1335
+ pandoc==2.4 ; python_version >= "3.10" and python_version < "3.11" \
1336
+ --hash=sha256:ecd1f8cbb7f4180c6b5db4a17a7c1a74df519995f5f186ef81ce72a9cbd0dd9a
1337
  pedalboard==0.9.16 ; python_version >= "3.10" and python_version < "3.11" \
1338
  --hash=sha256:031e6833c5983c3fe0a96bc4ff04790663a9e95a01c402828bd5a4eff4b8b541 \
1339
  --hash=sha256:03e73da46d6678a8adbd1ebc70bf38e4316918e44514eb9b1d7989bfb43cb30c \
 
1457
  platformdirs==4.3.6 ; python_version >= "3.10" and python_version < "3.11" \
1458
  --hash=sha256:357fb2acbc885b0419afd3ce3ed34564c13c9b95c89360cd9563f73aa5e2b907 \
1459
  --hash=sha256:73e575e1408ab8103900836b97580d5307456908a03e92031bab39e4554cc3fb
1460
+ plumbum==1.9.0 ; python_version >= "3.10" and python_version < "3.11" \
1461
+ --hash=sha256:9fd0d3b0e8d86e4b581af36edf3f3bbe9d1ae15b45b8caab28de1bcb27aaa7f5 \
1462
+ --hash=sha256:e640062b72642c3873bd5bdc3effed75ba4d3c70ef6b6a7b907357a84d909219
1463
+ ply==3.11 ; python_version >= "3.10" and python_version < "3.11" \
1464
+ --hash=sha256:00c7c1aaa88358b9c765b6d3000c6eec0ba42abca5351b095321aef446081da3 \
1465
+ --hash=sha256:096f9b8350b65ebd2fd1346b12452efe5b9607f7482813ffca50c22722a807ce
1466
  pooch==1.8.2 ; python_version >= "3.10" and python_version < "3.11" \
1467
  --hash=sha256:3529a57096f7198778a5ceefd5ac3ef0e4d06a6ddaf9fc2d609b806f25302c47 \
1468
  --hash=sha256:76561f0de68a01da4df6af38e9955c4c9d1a5c90da73f7e40276a5728ec83d10
 
1697
  pytz==2024.2 ; python_version >= "3.10" and python_version < "3.11" \
1698
  --hash=sha256:2aa355083c50a0f93fa581709deac0c9ad65cca8a9e9beac660adcbd493c798a \
1699
  --hash=sha256:31c7c1817eb7fae7ca4b8c7ee50c72f93aa2dd863de768e1ef4245d426aa0725
1700
+ pywin32==308 ; platform_system == "Windows" and platform_python_implementation != "PyPy" and python_version >= "3.10" and python_version < "3.11" \
1701
+ --hash=sha256:00b3e11ef09ede56c6a43c71f2d31857cf7c54b0ab6e78ac659497abd2834f47 \
1702
+ --hash=sha256:100a5442b7332070983c4cd03f2e906a5648a5104b8a7f50175f7906efd16bb6 \
1703
+ --hash=sha256:13dcb914ed4347019fbec6697a01a0aec61019c1046c2b905410d197856326a6 \
1704
+ --hash=sha256:1c44539a37a5b7b21d02ab34e6a4d314e0788f1690d65b48e9b0b89f31abbbed \
1705
+ --hash=sha256:1f696ab352a2ddd63bd07430080dd598e6369152ea13a25ebcdd2f503a38f1ff \
1706
+ --hash=sha256:3b92622e29d651c6b783e368ba7d6722b1634b8e70bd376fd7610fe1992e19de \
1707
+ --hash=sha256:4fc888c59b3c0bef905ce7eb7e2106a07712015ea1c8234b703a088d46110e8e \
1708
+ --hash=sha256:575621b90f0dc2695fec346b2d6302faebd4f0f45c05ea29404cefe35d89442b \
1709
+ --hash=sha256:5794e764ebcabf4ff08c555b31bd348c9025929371763b2183172ff4708152f0 \
1710
+ --hash=sha256:587f3e19696f4bf96fde9d8a57cec74a57021ad5f204c9e627e15c33ff568897 \
1711
+ --hash=sha256:5d8c8015b24a7d6855b1550d8e660d8daa09983c80e5daf89a273e5c6fb5095a \
1712
+ --hash=sha256:71b3322d949b4cc20776436a9c9ba0eeedcbc9c650daa536df63f0ff111bb920 \
1713
+ --hash=sha256:7873ca4dc60ab3287919881a7d4f88baee4a6e639aa6962de25a98ba6b193341 \
1714
+ --hash=sha256:796ff4426437896550d2981b9c2ac0ffd75238ad9ea2d3bfa67a1abd546d262e \
1715
+ --hash=sha256:9b4de86c8d909aed15b7011182c8cab38c8850de36e6afb1f0db22b8959e3091 \
1716
+ --hash=sha256:a5ab5381813b40f264fa3495b98af850098f814a25a63589a8e9eb12560f450c \
1717
+ --hash=sha256:ef313c46d4c18dfb82a2431e3051ac8f112ccee1a34f29c263c583c568db63cd \
1718
+ --hash=sha256:fd380990e792eaf6827fcb7e187b2b4b1cede0585e3d0c9e84201ec27b9905e4
1719
  pyyaml==6.0.2 ; python_version >= "3.10" and python_version < "3.11" \
1720
  --hash=sha256:01179a4a8559ab5de078078f37e5c1a30d76bb88519906844fd7bdea1b7729ff \
1721
  --hash=sha256:0833f8694549e586547b576dcfaba4a6b55b9e96098b36cdc7ebefe667dfed48 \
rvc/infer/infer.py CHANGED
@@ -1,42 +1,36 @@
 
1
  import os
2
- import sys
3
  import time
4
- import torch
 
5
  import librosa
6
- import logging
7
- import traceback
8
  import numpy as np
9
  import soundfile as sf
10
- import noisereduce as nr
11
  from pedalboard import (
12
  Pedalboard,
13
  )
14
  from pedalboard_native import (
15
- Chorus,
16
- Distortion,
17
- Reverb,
18
- PitchShift,
19
- Limiter,
20
- Gain,
21
  Bitcrush,
 
22
  Clipping,
23
  Compressor,
24
  Delay,
 
 
 
 
 
25
  )
26
 
27
- now_dir = os.getcwd()
28
- sys.path.append(now_dir)
29
-
30
  from rvc.infer.pipeline import Pipeline as VC
31
- from rvc.lib.utils import load_audio_infer, load_embedding
32
- from rvc.lib.tools.split_audio import process_audio, merge_audio
33
  from rvc.lib.algorithm.synthesizers import Synthesizer
34
- from rvc.configs.config import Config
 
35
 
36
- logging.getLogger("httpx").setLevel(logging.WARNING)
37
- logging.getLogger("httpcore").setLevel(logging.WARNING)
38
- logging.getLogger("faiss").setLevel(logging.WARNING)
39
- logging.getLogger("faiss.loader").setLevel(logging.WARNING)
40
 
41
 
42
  class VoiceConverter:
@@ -49,9 +43,7 @@ class VoiceConverter:
49
  Initializes the VoiceConverter with default configuration, and sets up models and parameters.
50
  """
51
  self.config = Config() # Load RVC configuration
52
- self.hubert_model = (
53
- None # Initialize the Hubert model (for embedding extraction)
54
- )
55
  self.last_embedder_model = None # Last used embedder model
56
  self.tgt_sr = None # Target sampling rate for the output audio
57
  self.net_g = None # Generator network for voice conversion
@@ -71,11 +63,7 @@ class VoiceConverter:
71
  """
72
  self.hubert_model = load_embedding(embedder_model, embedder_model_custom)
73
  self.hubert_model.to(self.config.device)
74
- self.hubert_model = (
75
- self.hubert_model.half()
76
- if self.config.is_half
77
- else self.hubert_model.float()
78
- )
79
  self.hubert_model.eval()
80
 
81
  @staticmethod
@@ -89,12 +77,10 @@ class VoiceConverter:
89
  reduction_strength (float): Strength of the noise reduction. Default is 0.7.
90
  """
91
  try:
92
- reduced_noise = nr.reduce_noise(
93
- y=data, sr=sr, prop_decrease=reduction_strength
94
- )
95
  return reduced_noise
96
  except Exception as error:
97
- print(f"An error occurred removing audio noise: {error}")
98
  return None
99
 
100
  @staticmethod
@@ -109,7 +95,7 @@ class VoiceConverter:
109
  """
110
  try:
111
  if output_format != "WAV":
112
- print(f"Converting audio to {output_format} format...")
113
  audio, sample_rate = librosa.load(input_path, sr=None)
114
  common_sample_rates = [
115
  8000,
@@ -123,13 +109,11 @@ class VoiceConverter:
123
  48000,
124
  ]
125
  target_sr = min(common_sample_rates, key=lambda x: abs(x - sample_rate))
126
- audio = librosa.resample(
127
- audio, orig_sr=sample_rate, target_sr=target_sr
128
- )
129
  sf.write(output_path, audio, target_sr, format=output_format.lower())
130
  return output_path
131
  except Exception as error:
132
- print(f"An error occurred converting the audio format: {error}")
133
 
134
  @staticmethod
135
  def post_process_audio(
@@ -195,7 +179,7 @@ class VoiceConverter:
195
  board.append(delay)
196
  return board(audio_input, sample_rate)
197
 
198
- def convert_audio(
199
  self,
200
  audio_input_path: str,
201
  audio_output_path: str,
@@ -221,6 +205,7 @@ class VoiceConverter:
221
  post_process: bool = False,
222
  resample_sr: int = 0,
223
  sid: int = 0,
 
224
  **kwargs,
225
  ):
226
  """
@@ -254,9 +239,9 @@ class VoiceConverter:
254
  self.get_vc(model_path, sid)
255
  try:
256
  start_time = time.time()
257
- print(f"Converting audio '{audio_input_path}'...")
258
 
259
- if upscale_audio == True:
260
  from audio_upscaler import upscale
261
 
262
  upscale(audio_input_path, audio_input_path)
@@ -274,27 +259,20 @@ class VoiceConverter:
274
  self.load_hubert(embedder_model, embedder_model_custom)
275
  self.last_embedder_model = embedder_model
276
 
277
- file_index = (
278
- index_path.strip()
279
- .strip('"')
280
- .strip("\n")
281
- .strip('"')
282
- .strip()
283
- .replace("trained", "added")
284
- )
285
 
286
  if self.tgt_sr != resample_sr >= 16000:
287
  self.tgt_sr = resample_sr
288
 
289
  if split_audio:
290
  chunks, intervals = process_audio(audio, 16000)
291
- print(f"Audio split into {len(chunks)} chunks for processing.")
292
  else:
293
  chunks = []
294
  chunks.append(audio)
295
 
296
  converted_chunks = []
297
- for c in chunks:
298
  if self.vc is None:
299
  raise Exception("Voice conversion model not loaded.")
300
  audio_opt = self.vc.pipeline(
@@ -318,17 +296,14 @@ class VoiceConverter:
318
  )
319
  converted_chunks.append(audio_opt)
320
  if split_audio:
321
- print(f"Converted audio chunk {len(converted_chunks)}")
 
 
322
 
323
- if split_audio:
324
- audio_opt = merge_audio(converted_chunks, intervals, 16000, self.tgt_sr)
325
- else:
326
- audio_opt = converted_chunks[0]
327
 
328
  if clean_audio:
329
- cleaned_audio = self.remove_audio_noise(
330
- audio_opt, self.tgt_sr, clean_strength
331
- )
332
  if cleaned_audio is not None:
333
  audio_opt = cleaned_audio
334
 
@@ -340,20 +315,13 @@ class VoiceConverter:
340
  )
341
 
342
  sf.write(audio_output_path, audio_opt, self.tgt_sr, format="WAV")
343
- output_path_format = audio_output_path.replace(
344
- ".wav", f".{export_format.lower()}"
345
- )
346
- audio_output_path = self.convert_audio_format(
347
- audio_output_path, output_path_format, export_format
348
- )
349
 
350
  elapsed_time = time.time() - start_time
351
- print(
352
- f"Conversion completed at '{audio_output_path}' in {elapsed_time:.2f} seconds."
353
- )
354
  except Exception as error:
355
- print(f"An error occurred during audio conversion: {error}")
356
- print(traceback.format_exc())
357
 
358
  def get_vc(self, weight_root, sid):
359
  """
@@ -397,11 +365,7 @@ class VoiceConverter:
397
  Args:
398
  weight_root (str): Path to the model weights.
399
  """
400
- self.cpt = (
401
- torch.load(weight_root, map_location="cpu")
402
- if os.path.isfile(weight_root)
403
- else None
404
- )
405
 
406
  def setup_network(self):
407
  """
@@ -423,9 +387,7 @@ class VoiceConverter:
423
  del self.net_g.enc_q
424
  self.net_g.load_state_dict(self.cpt["weight"], strict=False)
425
  self.net_g.eval().to(self.config.device)
426
- self.net_g = (
427
- self.net_g.half() if self.config.is_half else self.net_g.float()
428
- )
429
 
430
  def setup_vc_instance(self):
431
  """
 
1
+ import logging
2
  import os
 
3
  import time
4
+ from typing import Callable, Coroutine
5
+
6
  import librosa
7
+ import noisereduce as nr
 
8
  import numpy as np
9
  import soundfile as sf
10
+ import torch
11
  from pedalboard import (
12
  Pedalboard,
13
  )
14
  from pedalboard_native import (
 
 
 
 
 
 
15
  Bitcrush,
16
+ Chorus,
17
  Clipping,
18
  Compressor,
19
  Delay,
20
+ Distortion,
21
+ Gain,
22
+ Limiter,
23
+ PitchShift,
24
+ Reverb,
25
  )
26
 
27
+ from rvc.configs.config import Config
 
 
28
  from rvc.infer.pipeline import Pipeline as VC
 
 
29
  from rvc.lib.algorithm.synthesizers import Synthesizer
30
+ from rvc.lib.tools.split_audio import merge_audio, process_audio
31
+ from rvc.lib.utils import load_audio_infer, load_embedding
32
 
33
+ log = logging.getLogger(__name__)
 
 
 
34
 
35
 
36
  class VoiceConverter:
 
43
  Initializes the VoiceConverter with default configuration, and sets up models and parameters.
44
  """
45
  self.config = Config() # Load RVC configuration
46
+ self.hubert_model = None # Initialize the Hubert model (for embedding extraction)
 
 
47
  self.last_embedder_model = None # Last used embedder model
48
  self.tgt_sr = None # Target sampling rate for the output audio
49
  self.net_g = None # Generator network for voice conversion
 
63
  """
64
  self.hubert_model = load_embedding(embedder_model, embedder_model_custom)
65
  self.hubert_model.to(self.config.device)
66
+ self.hubert_model = self.hubert_model.half() if self.config.is_half else self.hubert_model.float()
 
 
 
 
67
  self.hubert_model.eval()
68
 
69
  @staticmethod
 
77
  reduction_strength (float): Strength of the noise reduction. Default is 0.7.
78
  """
79
  try:
80
+ reduced_noise = nr.reduce_noise(y=data, sr=sr, prop_decrease=reduction_strength)
 
 
81
  return reduced_noise
82
  except Exception as error:
83
+ log.error("An error occurred removing audio noise", exc_info=error)
84
  return None
85
 
86
  @staticmethod
 
95
  """
96
  try:
97
  if output_format != "WAV":
98
+ log.info(f"Converting audio to {output_format} format...")
99
  audio, sample_rate = librosa.load(input_path, sr=None)
100
  common_sample_rates = [
101
  8000,
 
109
  48000,
110
  ]
111
  target_sr = min(common_sample_rates, key=lambda x: abs(x - sample_rate))
112
+ audio = librosa.resample(audio, orig_sr=sample_rate, target_sr=target_sr)
 
 
113
  sf.write(output_path, audio, target_sr, format=output_format.lower())
114
  return output_path
115
  except Exception as error:
116
+ log.info("An error occurred converting the audio format", exc_info=error)
117
 
118
  @staticmethod
119
  def post_process_audio(
 
179
  board.append(delay)
180
  return board(audio_input, sample_rate)
181
 
182
+ async def convert_audio(
183
  self,
184
  audio_input_path: str,
185
  audio_output_path: str,
 
205
  post_process: bool = False,
206
  resample_sr: int = 0,
207
  sid: int = 0,
208
+ callback: Callable[[float], Coroutine[None, None, None]] | None = None,
209
  **kwargs,
210
  ):
211
  """
 
239
  self.get_vc(model_path, sid)
240
  try:
241
  start_time = time.time()
242
+ log.info(f"Converting audio '{audio_input_path}'...")
243
 
244
+ if upscale_audio:
245
  from audio_upscaler import upscale
246
 
247
  upscale(audio_input_path, audio_input_path)
 
259
  self.load_hubert(embedder_model, embedder_model_custom)
260
  self.last_embedder_model = embedder_model
261
 
262
+ file_index = index_path.strip().strip('"').strip("\n").strip('"').strip().replace("trained", "added")
 
 
 
 
 
 
 
263
 
264
  if self.tgt_sr != resample_sr >= 16000:
265
  self.tgt_sr = resample_sr
266
 
267
  if split_audio:
268
  chunks, intervals = process_audio(audio, 16000)
269
+ log.debug(f"Audio split into {len(chunks)} chunks for processing.")
270
  else:
271
  chunks = []
272
  chunks.append(audio)
273
 
274
  converted_chunks = []
275
+ for ix, c in enumerate(chunks):
276
  if self.vc is None:
277
  raise Exception("Voice conversion model not loaded.")
278
  audio_opt = self.vc.pipeline(
 
296
  )
297
  converted_chunks.append(audio_opt)
298
  if split_audio:
299
+ log.debug(f"Converted audio chunk {len(converted_chunks)}")
300
+ if callback is not None:
301
+ await callback((ix + 1) / len(chunks))
302
 
303
+ audio_opt = merge_audio(converted_chunks, intervals, 16000, self.tgt_sr) if split_audio else converted_chunks[0]
 
 
 
304
 
305
  if clean_audio:
306
+ cleaned_audio = self.remove_audio_noise(audio_opt, self.tgt_sr, clean_strength)
 
 
307
  if cleaned_audio is not None:
308
  audio_opt = cleaned_audio
309
 
 
315
  )
316
 
317
  sf.write(audio_output_path, audio_opt, self.tgt_sr, format="WAV")
318
+ output_path_format = audio_output_path.replace(".wav", f".{export_format.lower()}")
319
+ audio_output_path = self.convert_audio_format(audio_output_path, output_path_format, export_format)
 
 
 
 
320
 
321
  elapsed_time = time.time() - start_time
322
+ log.info(f"Conversion completed at '{audio_output_path}' in {elapsed_time:.2f} seconds.")
 
 
323
  except Exception as error:
324
+ log.error("An error occurred during audio conversion", exc_info=error)
 
325
 
326
  def get_vc(self, weight_root, sid):
327
  """
 
365
  Args:
366
  weight_root (str): Path to the model weights.
367
  """
368
+ self.cpt = torch.load(weight_root, map_location="cpu") if os.path.isfile(weight_root) else None
 
 
 
 
369
 
370
  def setup_network(self):
371
  """
 
387
  del self.net_g.enc_q
388
  self.net_g.load_state_dict(self.cpt["weight"], strict=False)
389
  self.net_g.eval().to(self.config.device)
390
+ self.net_g = self.net_g.half() if self.config.is_half else self.net_g.float()
 
 
391
 
392
  def setup_vc_instance(self):
393
  """
rvc/infer/pipeline.py CHANGED
@@ -1,24 +1,20 @@
1
- import os
2
  import gc
 
 
3
  import re
4
- import sys
5
- import torch
6
- import torch.nn.functional as F
7
- import torchcrepe
8
  import faiss
9
  import librosa
10
  import numpy as np
11
  import numpy.typing as npt
 
 
 
12
  from scipy import signal
13
  from torch import Tensor
14
 
15
- now_dir = os.getcwd()
16
- sys.path.append(now_dir)
17
-
18
- from rvc.lib.predictors.RMVPE import RMVPE0Predictor
19
  from rvc.lib.predictors.FCPE import FCPEF0Predictor
20
-
21
- import logging
22
 
23
  logging.getLogger("faiss").setLevel(logging.WARNING)
24
 
@@ -26,9 +22,7 @@ logging.getLogger("faiss").setLevel(logging.WARNING)
26
  FILTER_ORDER = 5
27
  CUTOFF_FREQUENCY = 48 # Hz
28
  SAMPLE_RATE = 16000 # Hz
29
- bh, ah = signal.butter(
30
- N=FILTER_ORDER, Wn=CUTOFF_FREQUENCY, btype="high", fs=SAMPLE_RATE
31
- )
32
 
33
  input_audio_path2wav: dict[str, npt.NDArray] = {}
34
 
@@ -82,10 +76,7 @@ class AudioProcessor:
82
  rms2 = torch.maximum(rms2, torch.zeros_like(rms2) + 1e-6)
83
 
84
  # Adjust target audio RMS based on the source audio RMS
85
- adjusted_audio = (
86
- target_audio
87
- * (torch.pow(rms1, 1 - rate) * torch.pow(rms2, rate - 1)).numpy()
88
- )
89
  return adjusted_audio
90
 
91
 
@@ -317,7 +308,7 @@ class Pipeline:
317
 
318
  f0_computation_stack = [fc for fc in f0_computation_stack if fc is not None]
319
  f0_median_hybrid = None
320
- if len(f0_computation_stack) == 1:
321
  f0_median_hybrid = f0_computation_stack[0]
322
  else:
323
  f0_median_hybrid = np.nanmedian(f0_computation_stack, axis=0)
@@ -354,9 +345,7 @@ class Pipeline:
354
  if f0_method == "crepe":
355
  f0 = self.get_f0_crepe(x, self.f0_min, self.f0_max, p_len, int(hop_length))
356
  elif f0_method == "crepe-tiny":
357
- f0 = self.get_f0_crepe(
358
- x, self.f0_min, self.f0_max, p_len, int(hop_length), "tiny"
359
- )
360
  elif f0_method == "rmvpe":
361
  f0 = self.model_rmvpe.infer_from_audio(x, thred=0.03)
362
  elif f0_method == "fcpe":
@@ -389,21 +378,13 @@ class Pipeline:
389
  f0 *= pow(2, pitch / 12)
390
  tf0 = self.sample_rate // self.window
391
  if inp_f0 is not None:
392
- delta_t = np.round(
393
- (inp_f0[:, 0].max() - inp_f0[:, 0].min()) * tf0 + 1
394
- ).astype("int16")
395
- replace_f0 = np.interp(
396
- list(range(delta_t)), inp_f0[:, 0] * 100, inp_f0[:, 1]
397
- )
398
  shape = f0[self.x_pad * tf0 : self.x_pad * tf0 + len(replace_f0)].shape[0]
399
- f0[self.x_pad * tf0 : self.x_pad * tf0 + len(replace_f0)] = replace_f0[
400
- :shape
401
- ]
402
  f0bak = f0.copy()
403
  f0_mel = 1127 * np.log(1 + f0 / 700)
404
- f0_mel[f0_mel > 0] = (f0_mel[f0_mel > 0] - self.f0_mel_min) * 254 / (
405
- self.f0_mel_max - self.f0_mel_min
406
- ) + 1
407
  f0_mel[f0_mel <= 1] = 1
408
  f0_mel[f0_mel > 255] = 255
409
  f0_coarse = np.rint(f0_mel).astype(np.int32)
@@ -441,58 +422,37 @@ class Pipeline:
441
  protect: Protection level for preserving the original pitch.
442
  """
443
  with torch.no_grad():
444
- pitch_guidance = pitch != None and pitchf != None
445
  # prepare source audio
446
- feats = (
447
- torch.from_numpy(audio0).half()
448
- if self.is_half
449
- else torch.from_numpy(audio0).float()
450
- )
451
  feats = feats.mean(-1) if feats.dim() == 2 else feats
452
  assert feats.dim() == 1, feats.dim()
453
  feats = feats.view(1, -1).to(self.device)
454
  # extract features
455
  feats = model(feats)["last_hidden_state"]
456
- feats = (
457
- model.final_proj(feats[0]).unsqueeze(0) if version == "v1" else feats
458
- )
459
  # make a copy for pitch guidance and protection
460
  feats0 = feats.clone() if pitch_guidance else None
461
- if (
462
- index
463
- ): # set by parent function, only true if index is available, loaded, and index rate > 0
464
- feats = self._retrieve_speaker_embeddings(
465
- feats, index, big_npy, index_rate
466
- )
467
  # feature upsampling
468
- feats = F.interpolate(feats.permute(0, 2, 1), scale_factor=2).permute(
469
- 0, 2, 1
470
- )
471
  # adjust the length if the audio is short
472
  p_len = min(audio0.shape[0] // self.window, feats.shape[1])
473
  if pitch_guidance:
474
- feats0 = F.interpolate(feats0.permute(0, 2, 1), scale_factor=2).permute(
475
- 0, 2, 1
476
- )
477
  pitch, pitchf = pitch[:, :p_len], pitchf[:, :p_len]
478
  # Pitch protection blending
479
  if protect < 0.5:
480
  pitchff = pitchf.clone()
481
  pitchff[pitchf > 0] = 1
482
  pitchff[pitchf < 1] = protect
483
- feats = feats * pitchff.unsqueeze(-1) + feats0 * (
484
- 1 - pitchff.unsqueeze(-1)
485
- )
486
  feats = feats.to(feats0.dtype)
487
  else:
488
  pitch, pitchf = None, None
489
  p_len = torch.tensor([p_len], device=self.device).long()
490
- audio1 = (
491
- (net_g.infer(feats, p_len, pitch, pitchf, sid)[0][0, 0])
492
- .data.cpu()
493
- .float()
494
- .numpy()
495
- )
496
  # clean up
497
  del feats, feats0, p_len
498
  if torch.cuda.is_available():
@@ -507,10 +467,7 @@ class Pipeline:
507
  weight /= weight.sum(axis=1, keepdims=True)
508
  npy = np.sum(big_npy[ix] * np.expand_dims(weight, axis=2), axis=1)
509
  npy = npy.astype("float16") if self.is_half else npy
510
- feats = (
511
- torch.from_numpy(npy).unsqueeze(0).to(self.device) * index_rate
512
- + (1 - index_rate) * feats
513
- )
514
  return feats
515
 
516
  def pipeline(
@@ -590,7 +547,7 @@ class Pipeline:
590
  inp_f0 = None
591
  if hasattr(f0_file, "name"):
592
  try:
593
- with open(f0_file.name, "r") as f:
594
  lines = f.read().strip("\n").split("\n")
595
  inp_f0 = []
596
  for line in lines:
@@ -687,9 +644,7 @@ class Pipeline:
687
  )
688
  audio_opt = np.concatenate(audio_opt)
689
  if volume_envelope != 1:
690
- audio_opt = AudioProcessor.change_rms(
691
- audio, self.sample_rate, audio_opt, self.sample_rate, volume_envelope
692
- )
693
  # if resample_sr >= self.sample_rate and tgt_sr != resample_sr:
694
  # audio_opt = librosa.resample(
695
  # audio_opt, orig_sr=tgt_sr, target_sr=resample_sr
 
 
1
  import gc
2
+ import logging
3
+ import os
4
  import re
5
+
 
 
 
6
  import faiss
7
  import librosa
8
  import numpy as np
9
  import numpy.typing as npt
10
+ import torch
11
+ import torch.nn.functional as F
12
+ import torchcrepe
13
  from scipy import signal
14
  from torch import Tensor
15
 
 
 
 
 
16
  from rvc.lib.predictors.FCPE import FCPEF0Predictor
17
+ from rvc.lib.predictors.RMVPE import RMVPE0Predictor
 
18
 
19
  logging.getLogger("faiss").setLevel(logging.WARNING)
20
 
 
22
  FILTER_ORDER = 5
23
  CUTOFF_FREQUENCY = 48 # Hz
24
  SAMPLE_RATE = 16000 # Hz
25
+ bh, ah = signal.butter(N=FILTER_ORDER, Wn=CUTOFF_FREQUENCY, btype="high", fs=SAMPLE_RATE)
 
 
26
 
27
  input_audio_path2wav: dict[str, npt.NDArray] = {}
28
 
 
76
  rms2 = torch.maximum(rms2, torch.zeros_like(rms2) + 1e-6)
77
 
78
  # Adjust target audio RMS based on the source audio RMS
79
+ adjusted_audio = target_audio * (torch.pow(rms1, 1 - rate) * torch.pow(rms2, rate - 1)).numpy()
 
 
 
80
  return adjusted_audio
81
 
82
 
 
308
 
309
  f0_computation_stack = [fc for fc in f0_computation_stack if fc is not None]
310
  f0_median_hybrid = None
311
+ if len(f0_computation_stack) == 1: # noqa: SIM108
312
  f0_median_hybrid = f0_computation_stack[0]
313
  else:
314
  f0_median_hybrid = np.nanmedian(f0_computation_stack, axis=0)
 
345
  if f0_method == "crepe":
346
  f0 = self.get_f0_crepe(x, self.f0_min, self.f0_max, p_len, int(hop_length))
347
  elif f0_method == "crepe-tiny":
348
+ f0 = self.get_f0_crepe(x, self.f0_min, self.f0_max, p_len, int(hop_length), "tiny")
 
 
349
  elif f0_method == "rmvpe":
350
  f0 = self.model_rmvpe.infer_from_audio(x, thred=0.03)
351
  elif f0_method == "fcpe":
 
378
  f0 *= pow(2, pitch / 12)
379
  tf0 = self.sample_rate // self.window
380
  if inp_f0 is not None:
381
+ delta_t = np.round((inp_f0[:, 0].max() - inp_f0[:, 0].min()) * tf0 + 1).astype("int16")
382
+ replace_f0 = np.interp(list(range(delta_t)), inp_f0[:, 0] * 100, inp_f0[:, 1])
 
 
 
 
383
  shape = f0[self.x_pad * tf0 : self.x_pad * tf0 + len(replace_f0)].shape[0]
384
+ f0[self.x_pad * tf0 : self.x_pad * tf0 + len(replace_f0)] = replace_f0[:shape]
 
 
385
  f0bak = f0.copy()
386
  f0_mel = 1127 * np.log(1 + f0 / 700)
387
+ f0_mel[f0_mel > 0] = (f0_mel[f0_mel > 0] - self.f0_mel_min) * 254 / (self.f0_mel_max - self.f0_mel_min) + 1
 
 
388
  f0_mel[f0_mel <= 1] = 1
389
  f0_mel[f0_mel > 255] = 255
390
  f0_coarse = np.rint(f0_mel).astype(np.int32)
 
422
  protect: Protection level for preserving the original pitch.
423
  """
424
  with torch.no_grad():
425
+ pitch_guidance = pitch is not None and pitchf is not None
426
  # prepare source audio
427
+ feats = torch.from_numpy(audio0).half() if self.is_half else torch.from_numpy(audio0).float()
 
 
 
 
428
  feats = feats.mean(-1) if feats.dim() == 2 else feats
429
  assert feats.dim() == 1, feats.dim()
430
  feats = feats.view(1, -1).to(self.device)
431
  # extract features
432
  feats = model(feats)["last_hidden_state"]
433
+ feats = model.final_proj(feats[0]).unsqueeze(0) if version == "v1" else feats
 
 
434
  # make a copy for pitch guidance and protection
435
  feats0 = feats.clone() if pitch_guidance else None
436
+ if index: # set by parent function, only true if index is available, loaded, and index rate > 0
437
+ feats = self._retrieve_speaker_embeddings(feats, index, big_npy, index_rate)
 
 
 
 
438
  # feature upsampling
439
+ feats = F.interpolate(feats.permute(0, 2, 1), scale_factor=2).permute(0, 2, 1)
 
 
440
  # adjust the length if the audio is short
441
  p_len = min(audio0.shape[0] // self.window, feats.shape[1])
442
  if pitch_guidance:
443
+ feats0 = F.interpolate(feats0.permute(0, 2, 1), scale_factor=2).permute(0, 2, 1)
 
 
444
  pitch, pitchf = pitch[:, :p_len], pitchf[:, :p_len]
445
  # Pitch protection blending
446
  if protect < 0.5:
447
  pitchff = pitchf.clone()
448
  pitchff[pitchf > 0] = 1
449
  pitchff[pitchf < 1] = protect
450
+ feats = feats * pitchff.unsqueeze(-1) + feats0 * (1 - pitchff.unsqueeze(-1))
 
 
451
  feats = feats.to(feats0.dtype)
452
  else:
453
  pitch, pitchf = None, None
454
  p_len = torch.tensor([p_len], device=self.device).long()
455
+ audio1 = (net_g.infer(feats, p_len, pitch, pitchf, sid)[0][0, 0]).data.cpu().float().numpy()
 
 
 
 
 
456
  # clean up
457
  del feats, feats0, p_len
458
  if torch.cuda.is_available():
 
467
  weight /= weight.sum(axis=1, keepdims=True)
468
  npy = np.sum(big_npy[ix] * np.expand_dims(weight, axis=2), axis=1)
469
  npy = npy.astype("float16") if self.is_half else npy
470
+ feats = torch.from_numpy(npy).unsqueeze(0).to(self.device) * index_rate + (1 - index_rate) * feats
 
 
 
471
  return feats
472
 
473
  def pipeline(
 
547
  inp_f0 = None
548
  if hasattr(f0_file, "name"):
549
  try:
550
+ with open(f0_file.name) as f:
551
  lines = f.read().strip("\n").split("\n")
552
  inp_f0 = []
553
  for line in lines:
 
644
  )
645
  audio_opt = np.concatenate(audio_opt)
646
  if volume_envelope != 1:
647
+ audio_opt = AudioProcessor.change_rms(audio, self.sample_rate, audio_opt, self.sample_rate, volume_envelope)
 
 
648
  # if resample_sr >= self.sample_rate and tgt_sr != resample_sr:
649
  # audio_opt = librosa.resample(
650
  # audio_opt, orig_sr=tgt_sr, target_sr=resample_sr
rvc/lib/algorithm/commons.py CHANGED
@@ -1,7 +1,7 @@
1
- import math
2
- import torch
3
  from typing import List, Optional
4
 
 
 
5
 
6
  def init_weights(m, mean=0.0, std=0.01):
7
  """
@@ -40,9 +40,7 @@ def convert_pad_shape(pad_shape):
40
  return pad_shape
41
 
42
 
43
- def slice_segments(
44
- x: torch.Tensor, ids_str: torch.Tensor, segment_size: int = 4, dim: int = 2
45
- ):
46
  """
47
  Slice segments from a tensor, handling tensors with different numbers of dimensions.
48
 
@@ -126,29 +124,3 @@ def sequence_mask(length: torch.Tensor, max_length: Optional[int] = None):
126
  max_length = length.max()
127
  x = torch.arange(max_length, dtype=length.dtype, device=length.device)
128
  return x.unsqueeze(0) < length.unsqueeze(1)
129
-
130
-
131
- def clip_grad_value(parameters, clip_value, norm_type=2):
132
- """
133
- Clip the gradients of a list of parameters.
134
-
135
- Args:
136
- parameters: The list of parameters to clip.
137
- clip_value: The maximum value of the gradients.
138
- norm_type: The type of norm to use for clipping.
139
- """
140
- if isinstance(parameters, torch.Tensor):
141
- parameters = [parameters]
142
- parameters = list(filter(lambda p: p.grad is not None, parameters))
143
- norm_type = float(norm_type)
144
- if clip_value is not None:
145
- clip_value = float(clip_value)
146
-
147
- total_norm = 0
148
- for p in parameters:
149
- param_norm = p.grad.data.norm(norm_type)
150
- total_norm += param_norm.item() ** norm_type
151
- if clip_value is not None:
152
- p.grad.data.clamp_(min=-clip_value, max=clip_value)
153
- total_norm = total_norm ** (1.0 / norm_type)
154
- return total_norm
 
 
 
1
  from typing import List, Optional
2
 
3
+ import torch
4
+
5
 
6
  def init_weights(m, mean=0.0, std=0.01):
7
  """
 
40
  return pad_shape
41
 
42
 
43
+ def slice_segments(x: torch.Tensor, ids_str: torch.Tensor, segment_size: int = 4, dim: int = 2):
 
 
44
  """
45
  Slice segments from a tensor, handling tensors with different numbers of dimensions.
46
 
 
124
  max_length = length.max()
125
  x = torch.arange(max_length, dtype=length.dtype, device=length.device)
126
  return x.unsqueeze(0) < length.unsqueeze(1)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
rvc/lib/tools/split_audio.py CHANGED
@@ -1,5 +1,5 @@
1
- import numpy as np
2
  import librosa
 
3
 
4
 
5
  def process_audio(audio, sr=16000, silence_thresh=-60, min_silence_len=250):
@@ -18,9 +18,10 @@ def process_audio(audio, sr=16000, silence_thresh=-60, min_silence_len=250):
18
  """
19
  frame_length = int(min_silence_len / 1000 * sr)
20
  hop_length = frame_length // 2
21
- intervals = librosa.effects.split(
22
- audio, top_db=-silence_thresh, frame_length=frame_length, hop_length=hop_length
23
- )
 
24
  audio_segments = [audio[start:end] for start, end in intervals]
25
 
26
  return audio_segments, intervals
 
 
1
  import librosa
2
+ import numpy as np
3
 
4
 
5
  def process_audio(audio, sr=16000, silence_thresh=-60, min_silence_len=250):
 
18
  """
19
  frame_length = int(min_silence_len / 1000 * sr)
20
  hop_length = frame_length // 2
21
+ intervals = librosa.effects.split(audio, top_db=-silence_thresh, frame_length=frame_length, hop_length=hop_length)
22
+ intervals[0, 0] = 0
23
+ intervals[1:, 0] = intervals[:-1, 1]
24
+ intervals[-1, 1] = len(audio)
25
  audio_segments = [audio[start:end] for start, end in intervals]
26
 
27
  return audio_segments, intervals
tabs/tts/tts.py CHANGED
@@ -1,11 +1,15 @@
 
 
1
  import gradio as gr
2
 
3
  from assets.i18n.i18n import I18nAuto
4
- from core import run_tts_script
5
  from tts_service.voices import voice_manager
6
 
7
  i18n = I18nAuto()
8
 
 
 
9
 
10
  # TTS tab
11
  def tts_tab():
@@ -32,6 +36,7 @@ def tts_tab():
32
  label=i18n("Text to Synthesize"),
33
  info=i18n("Enter the text to synthesize."),
34
  placeholder=i18n("Enter text to synthesize"),
 
35
  lines=3,
36
  )
37
 
 
1
+ from pathlib import Path
2
+
3
  import gradio as gr
4
 
5
  from assets.i18n.i18n import I18nAuto
6
+ from tts_service.tts import run_tts_script
7
  from tts_service.voices import voice_manager
8
 
9
  i18n = I18nAuto()
10
 
11
+ sample = Path("notebooks/sample.txt").read_text()
12
+
13
 
14
  # TTS tab
15
  def tts_tab():
 
36
  label=i18n("Text to Synthesize"),
37
  info=i18n("Enter the text to synthesize."),
38
  placeholder=i18n("Enter text to synthesize"),
39
+ value=sample,
40
  lines=3,
41
  )
42
 
tabs/workflow/workflow.py ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ from assets.i18n.i18n import I18nAuto
4
+ from tts_service.docs import document_manager
5
+ from tts_service.tts import run_tts_script
6
+ from tts_service.utils import html_to_markdown, markdown_to_text
7
+
8
+ i18n = I18nAuto()
9
+
10
+
11
+ async def fetch_document(source: str) -> tuple[str, gr.Dataset]:
12
+ doc = await document_manager.get_doc(source)
13
+ if doc:
14
+ overline = doc.get("overline")
15
+ title = doc.get("title")
16
+ underline = doc.get("underline")
17
+ authors = doc.get("authors")
18
+ content = doc["content"]
19
+ pieces = []
20
+ if overline:
21
+ pieces.append(f"### {overline}")
22
+ if title:
23
+ pieces.append(f"# {title}")
24
+ if underline:
25
+ pieces.append(f"### {underline}")
26
+ if authors:
27
+ pieces.append(f"#### By {','.join(authors)}")
28
+ content = html_to_markdown(content)
29
+ pieces.append(content)
30
+ content = "\n\n".join(pieces)
31
+ text = markdown_to_text(content)
32
+ return content, text
33
+ return "", ""
34
+
35
+
36
+ # TTS tab
37
+ def workflow_tab():
38
+ with gr.Row():
39
+ with gr.Column():
40
+ source = gr.Textbox(
41
+ label=i18n("Source"),
42
+ info=i18n("Enter the document ID or URL."),
43
+ )
44
+ fetch_button = gr.Button(i18n("Fetch"))
45
+
46
+ text = gr.Textbox(
47
+ label=i18n("Text"),
48
+ interactive=True,
49
+ )
50
+
51
+ synthesize_button = gr.Button(i18n("Synthesize"))
52
+
53
+ status = gr.Textbox(visible=False)
54
+
55
+ audio = gr.Audio(label=i18n("Export Audio"))
56
+
57
+ with gr.Column():
58
+ markdown = gr.Markdown(
59
+ label=i18n("Document"),
60
+ )
61
+
62
+ fetch_button.click(
63
+ fn=fetch_document,
64
+ inputs=[source],
65
+ outputs=[markdown, text],
66
+ )
67
+
68
+ synthesize_button.click(
69
+ fn=run_tts_script,
70
+ inputs=[text],
71
+ outputs=[status, audio],
72
+ )
tts_service/app.py CHANGED
@@ -1,14 +1,16 @@
1
  import logging
2
  import sys
 
3
 
4
  import gradio as gr
 
5
 
6
  import assets.installation_checker as installation_checker
7
  import assets.themes.loadThemes as loadThemes
8
  from assets.i18n.i18n import I18nAuto
9
- from core import run_prerequisites_script
10
  from tabs.plugins import plugins_core
11
- from tabs.tts.tts import tts_tab
12
  from tts_service.utils import env_bool
13
 
14
  # Set up logging
@@ -20,8 +22,7 @@ logging.getLogger("httpx").setLevel(logging.WARNING)
20
  plugins_core.check_new_folders()
21
 
22
  # Run prerequisites
23
-
24
- run_prerequisites_script(
25
  pretraineds_v1_f0=False,
26
  pretraineds_v1_nof0=False,
27
  pretraineds_v2_f0=True,
@@ -45,12 +46,23 @@ my_applio = loadThemes.load_theme() or "ParityError/Interstellar"
45
  # Define Gradio interface
46
  with gr.Blocks(theme=my_applio, title="TTS Playground", css="footer{display:none !important}") as app:
47
  gr.Markdown("# Text-to-Speech Playground")
48
- gr.Markdown(i18n("Select a voice model, enter text, and press 'Convert' to synthesize speech."))
49
- with gr.Tab(i18n("TTS")):
50
- tts_tab()
 
 
 
 
 
 
 
 
 
 
51
 
52
 
53
  def launch_gradio():
 
54
  app.queue(status_update_rate=1).launch(
55
  favicon_path="assets/ICON.ico",
56
  share="--share" in sys.argv,
 
1
  import logging
2
  import sys
3
+ from pathlib import Path
4
 
5
  import gradio as gr
6
+ import yaml
7
 
8
  import assets.installation_checker as installation_checker
9
  import assets.themes.loadThemes as loadThemes
10
  from assets.i18n.i18n import I18nAuto
11
+ from rvc.lib.tools.prerequisites_download import prequisites_download_pipeline
12
  from tabs.plugins import plugins_core
13
+ from tabs.workflow.workflow import workflow_tab
14
  from tts_service.utils import env_bool
15
 
16
  # Set up logging
 
22
  plugins_core.check_new_folders()
23
 
24
  # Run prerequisites
25
+ prequisites_download_pipeline(
 
26
  pretraineds_v1_f0=False,
27
  pretraineds_v1_nof0=False,
28
  pretraineds_v2_f0=True,
 
46
  # Define Gradio interface
47
  with gr.Blocks(theme=my_applio, title="TTS Playground", css="footer{display:none !important}") as app:
48
  gr.Markdown("# Text-to-Speech Playground")
49
+ gr.Markdown(i18n("Enter a page URL, click fetch and then synthesize"))
50
+ with gr.Tab(i18n("Workflow")):
51
+ workflow_tab()
52
+
53
+
54
+ def setup_logging():
55
+ path = Path("logging.yml")
56
+ if not path.exists():
57
+ return
58
+ with path.open() as f:
59
+ from logging.config import dictConfig
60
+
61
+ dictConfig(yaml.safe_load(f))
62
 
63
 
64
  def launch_gradio():
65
+ setup_logging()
66
  app.queue(status_update_rate=1).launch(
67
  favicon_path="assets/ICON.ico",
68
  share="--share" in sys.argv,
tts_service/docs.py ADDED
@@ -0,0 +1,151 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+ import logging
3
+ import re
4
+ from typing import Any, TypedDict
5
+
6
+ import httpx
7
+
8
+ from tts_service.utils import env_str
9
+
10
+
11
+ class WorkflowData(TypedDict):
12
+ status: str
13
+ writers: list[str]
14
+ editors: list[str]
15
+ proofers: list[str]
16
+ reviewers: list[str]
17
+ proofingDeadline: str
18
+
19
+
20
+ class Document(TypedDict):
21
+ _id: str
22
+ _rev: str
23
+ type: str
24
+ mimetype: str
25
+ title: str
26
+ language: str
27
+ workflowData: WorkflowData
28
+ path: str
29
+ name: str
30
+ created: int
31
+ creator: str
32
+ lastPublished: int
33
+ firstPublished: int
34
+ modified: int
35
+ modifier: str
36
+ published: int
37
+ authors: list[str]
38
+ content: str
39
+ contentAssets: list[str]
40
+ featuredImages: list[str]
41
+ keywords: list[str]
42
+ topics: list[str]
43
+ relatedAssets: list[str]
44
+ comments: bool
45
+ campaignConfigs: list[Any]
46
+ order: int
47
+ overline: str
48
+ translatedFrom: str
49
+ socialTitles: list[Any]
50
+ socialDescriptions: list[Any]
51
+ socialFeaturedImages: list[Any]
52
+ underline: str
53
+ template: str
54
+ description: str
55
+ suggestedImages: list[str]
56
+ publisher: str
57
+
58
+
59
+ class DocumentManager:
60
+ def __init__(self) -> None:
61
+ self.client = self.make_client()
62
+ self.path_view = env_str("DOCS_PATH_VIEW")
63
+
64
+ def make_client(self) -> httpx.AsyncClient:
65
+ base_url = env_str("DOCS_URL")
66
+ auth = env_str("DOCS_AUTH")
67
+ headers = {"Authorization": f"Basic {auth}"}
68
+ client = httpx.AsyncClient(base_url=base_url, headers=headers)
69
+ return client
70
+
71
+ async def get_doc_by_id(self, doc_id: str) -> Document | None:
72
+ try:
73
+ response = await self.client.get(doc_id)
74
+ if response.status_code == 404:
75
+ return None
76
+ response.raise_for_status()
77
+ return response.json()
78
+ except Exception as e:
79
+ logging.error("Error fetching document by ID", exc_info=e)
80
+ return None
81
+
82
+ async def get_doc_by_path(self, path: str) -> Document | None:
83
+ try:
84
+ params = {
85
+ "limit": "1",
86
+ "key": json.dumps(path),
87
+ "include_docs": "true",
88
+ }
89
+ response = await self.client.get(self.path_view, params=params)
90
+ response.raise_for_status()
91
+ data = response.json()
92
+ rows = data["rows"]
93
+ if not rows:
94
+ return None
95
+ return rows[0]["doc"]
96
+ except Exception as e:
97
+ logging.error("Error fetching document by path", exc_info=e)
98
+ return None
99
+
100
+ async def get_doc(self, id_or_path: str) -> Document | None:
101
+ uuids = extract_doc_ids(id_or_path)
102
+ for uuid in uuids:
103
+ doc = await self.get_doc_by_id(uuid)
104
+ if doc:
105
+ return doc
106
+
107
+ path = extract_doc_path(id_or_path)
108
+ if path:
109
+ return await self.get_doc_by_path(path)
110
+
111
+ return None
112
+
113
+
114
+ UUID_PATTERN = re.compile(r"[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}")
115
+
116
+
117
+ def extract_doc_ids(s: str) -> list[str]:
118
+ return UUID_PATTERN.findall(s)
119
+
120
+
121
+ def extract_doc_path(s: str) -> str | None:
122
+ if not s.endswith(".html"):
123
+ return None
124
+ if s.startswith("/"):
125
+ return s
126
+ if "://" in s:
127
+ s = s.split("://", 1)[1]
128
+ if "/" in s:
129
+ return "/" + s.split("/", 1)[1]
130
+ return None
131
+
132
+
133
+ document_manager = DocumentManager()
134
+
135
+
136
+ if __name__ == "__main__":
137
+
138
+ async def main() -> None:
139
+ db = DocumentManager()
140
+ # result = await db.get_doc_by_id("b7fdc644-5b24-40ae-b489-37b3fc0c5541")
141
+ # result = await db.get_doc_by_path("/en/articles/2024/11/28/slci-n28.html")
142
+ # result = await db.get_doc("https://www.cnn.com/en/articles/2024/11/28/slci-n28.html")
143
+ result = await db.get_doc("https://bbc.com/news/the-2024-us-elections-efb37bf1-16bb-4bbb-88ce-4273cf657c11")
144
+ print(json.dumps(result, indent=2))
145
+
146
+ import asyncio
147
+
148
+ from dotenv import load_dotenv
149
+
150
+ load_dotenv()
151
+ asyncio.run(main())
tts_service/tts.py ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import asyncio
2
+ import json
3
+ import logging
4
+ import os
5
+ from functools import lru_cache
6
+
7
+ import edge_tts
8
+ import gradio as gr
9
+
10
+ from tts_service.utils import cache_path
11
+ from tts_service.voices import voice_manager
12
+
13
+ log = logging.getLogger(__name__)
14
+
15
+
16
+ @lru_cache(maxsize=None)
17
+ def import_voice_converter():
18
+ from rvc.infer.infer import VoiceConverter
19
+
20
+ return VoiceConverter()
21
+
22
+
23
+ # TTS
24
+ async def run_tts_script(
25
+ text: str,
26
+ voice_name: str = "male-1",
27
+ rate: int = 0,
28
+ progress=gr.Progress(), # noqa: B008
29
+ ) -> tuple[str, str]:
30
+ async def update_progress(pct, msg) -> None:
31
+ log.debug("Progress: %.1f%%: %s", pct * 100, msg)
32
+ progress(pct, msg)
33
+ await asyncio.sleep(0)
34
+
35
+ await update_progress(0, "Starting...")
36
+ voice = voice_manager.voices[voice_name]
37
+ format = "wav"
38
+
39
+ text = text.strip()
40
+ output_tts_path = cache_path(voice.tts, "", rate, text, extension=format)
41
+ text_ptr = 0
42
+ if not os.path.exists(output_tts_path):
43
+ rates = f"+{rate}%" if rate >= 0 else f"{rate}%"
44
+ communicate = edge_tts.Communicate(text, voice.tts, rate=rates)
45
+ with open(output_tts_path, "wb") as f:
46
+ async for chunk in communicate.stream():
47
+ chunk_type = chunk["type"]
48
+ if chunk_type == "audio":
49
+ f.write(chunk["data"])
50
+ elif chunk_type == "WordBoundary":
51
+ chunk_text = chunk["text"]
52
+ text_index = text.index(chunk_text, text_ptr)
53
+ if text_index == -1:
54
+ log.warning("Extraneous text received from edge tts: %s", chunk_text)
55
+ continue
56
+ text_ptr = text_index + len(chunk_text)
57
+ pct_complete = text_ptr / len(text)
58
+ log.debug("%.1f%%: %s", pct_complete * 100, chunk)
59
+ await update_progress(pct_complete / 2, "Synthesizing...")
60
+ else:
61
+ log.warning("Unknown chunk type: %s: %s", chunk_type, json.dumps(chunk))
62
+
63
+ output_rvc_path = cache_path(voice.tts, voice.name, rate, text, extension=format)
64
+ if not os.path.exists(output_rvc_path):
65
+ infer_pipeline = import_voice_converter()
66
+ await infer_pipeline.convert_audio(
67
+ pitch=voice.pitch,
68
+ filter_radius=voice.filter_radius,
69
+ index_rate=voice.index_rate,
70
+ volume_envelope=voice.rms_mix_rate,
71
+ protect=voice.protect,
72
+ hop_length=voice.hop_length,
73
+ f0_method=voice.f0_method,
74
+ audio_input_path=str(output_tts_path),
75
+ audio_output_path=str(output_rvc_path),
76
+ model_path=voice.model,
77
+ index_path=voice.index,
78
+ split_audio=True,
79
+ f0_autotune=voice.autotune is not None,
80
+ f0_autotune_strength=voice.autotune,
81
+ clean_audio=voice.clean is not None,
82
+ clean_strength=voice.clean,
83
+ export_format=format.upper(),
84
+ upscale_audio=voice.upscale,
85
+ f0_file=None,
86
+ embedder_model=voice.embedder_model,
87
+ embedder_model_custom=None,
88
+ sid=0,
89
+ formant_shifting=None,
90
+ formant_qfrency=None,
91
+ formant_timbre=None,
92
+ post_process=None,
93
+ reverb=None,
94
+ pitch_shift=None,
95
+ limiter=None,
96
+ gain=None,
97
+ distortion=None,
98
+ chorus=None,
99
+ bitcrush=None,
100
+ clipping=None,
101
+ compressor=None,
102
+ delay=None,
103
+ sliders=None,
104
+ callback=lambda pct: update_progress(0.5 + pct / 2, "Converting..."),
105
+ )
106
+
107
+ return "Text synthesized successfully.", str(output_rvc_path)
108
+
109
+
110
+ # Prerequisites
tts_service/utils.py CHANGED
@@ -1,7 +1,9 @@
1
  import hashlib
2
  import os
3
  from pathlib import Path
4
- from typing import Any
 
 
5
 
6
 
7
  class Unspecified:
@@ -47,3 +49,15 @@ def cache_path(*keys: Any, extension: str | None = None) -> Path:
47
  if extension:
48
  name += f".{extension}"
49
  return dir_path / name
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import hashlib
2
  import os
3
  from pathlib import Path
4
+ from typing import Any, cast
5
+
6
+ import pandoc
7
 
8
 
9
  class Unspecified:
 
49
  if extension:
50
  name += f".{extension}"
51
  return dir_path / name
52
+
53
+
54
+ def html_to_markdown(html: str) -> str:
55
+ doc = pandoc.read(html, format="html")
56
+ md = pandoc.write(doc, format="markdown-smart", options=["--wrap=none"])
57
+ return cast(str, md)
58
+
59
+
60
+ def markdown_to_text(md: str) -> str:
61
+ doc = pandoc.read(md, format="markdown")
62
+ txt = pandoc.write(doc, format="plain-smart", options=["--wrap=none"])
63
+ return cast(str, txt)
tts_service/whitelist.py CHANGED
@@ -11,12 +11,33 @@ _.secondary_800 # unused attribute (assets/themes/Applio.py:52)
11
  _.secondary_900 # unused attribute (assets/themes/Applio.py:53)
12
  _.secondary_950 # unused attribute (assets/themes/Applio.py:54)
13
  __getattr__ # unused function (rvc/lib/predictors/FCPE.py:799)
14
- _.graph # unused attribute (rvc/lib/zluda.py:33)
15
- _.enabled # unused attribute (rvc/lib/zluda.py:40)
16
- _.nprobe # unused attribute (rvc/train/process/extract_index.py:76)
17
- rvc # unused import (rvc/train/train.py:28)
18
- _.deterministic # unused attribute (rvc/train/train.py:78)
19
- _.benchmark # unused attribute (rvc/train/train.py:79)
20
- losses_disc_g # unused variable (rvc/train/train.py:630)
21
- losses_disc_r # unused variable (rvc/train/train.py:630)
22
- losses_gen # unused variable (rvc/train/train.py:649)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  _.secondary_900 # unused attribute (assets/themes/Applio.py:53)
12
  _.secondary_950 # unused attribute (assets/themes/Applio.py:54)
13
  __getattr__ # unused function (rvc/lib/predictors/FCPE.py:799)
14
+ status # unused variable (tts_service/docs.py:12)
15
+ writers # unused variable (tts_service/docs.py:13)
16
+ editors # unused variable (tts_service/docs.py:14)
17
+ proofers # unused variable (tts_service/docs.py:15)
18
+ reviewers # unused variable (tts_service/docs.py:16)
19
+ proofingDeadline # unused variable (tts_service/docs.py:17)
20
+ mimetype # unused variable (tts_service/docs.py:24)
21
+ workflowData # unused variable (tts_service/docs.py:27)
22
+ created # unused variable (tts_service/docs.py:30)
23
+ creator # unused variable (tts_service/docs.py:31)
24
+ lastPublished # unused variable (tts_service/docs.py:32)
25
+ firstPublished # unused variable (tts_service/docs.py:33)
26
+ modified # unused variable (tts_service/docs.py:34)
27
+ modifier # unused variable (tts_service/docs.py:35)
28
+ published # unused variable (tts_service/docs.py:36)
29
+ contentAssets # unused variable (tts_service/docs.py:39)
30
+ featuredImages # unused variable (tts_service/docs.py:40)
31
+ keywords # unused variable (tts_service/docs.py:41)
32
+ topics # unused variable (tts_service/docs.py:42)
33
+ relatedAssets # unused variable (tts_service/docs.py:43)
34
+ comments # unused variable (tts_service/docs.py:44)
35
+ campaignConfigs # unused variable (tts_service/docs.py:45)
36
+ order # unused variable (tts_service/docs.py:46)
37
+ translatedFrom # unused variable (tts_service/docs.py:48)
38
+ socialTitles # unused variable (tts_service/docs.py:49)
39
+ socialDescriptions # unused variable (tts_service/docs.py:50)
40
+ socialFeaturedImages # unused variable (tts_service/docs.py:51)
41
+ description # unused variable (tts_service/docs.py:54)
42
+ suggestedImages # unused variable (tts_service/docs.py:55)
43
+ publisher # unused variable (tts_service/docs.py:56)