Spaces:
Sleeping
Sleeping
fix: refine chunks
Browse files
app.py
CHANGED
@@ -45,7 +45,6 @@ def split_text_into_chunks(text, max_chunk_length):
|
|
45 |
|
46 |
if current_chunk:
|
47 |
chunks.append(current_chunk.strip())
|
48 |
-
|
49 |
return chunks
|
50 |
|
51 |
|
@@ -88,7 +87,7 @@ def main():
|
|
88 |
else:
|
89 |
sentence = load_text_file(uploaded_file)
|
90 |
st.write(f"{len(sentence)} characters and {len(sentence.split())} words")
|
91 |
-
st.write(sentence)
|
92 |
|
93 |
with audioTab:
|
94 |
st.text("Yet to be implemented...")
|
@@ -98,8 +97,8 @@ def main():
|
|
98 |
|
99 |
with st.spinner("Generating Summary..."):
|
100 |
if button and sentence:
|
101 |
-
chunks = split_text_into_chunks(sentence,
|
102 |
-
print(chunks)
|
103 |
|
104 |
text_words = len(sentence.split())
|
105 |
if summary_balance == "concise":
|
@@ -112,7 +111,7 @@ def main():
|
|
112 |
min_multiplier = text_words * 0.2
|
113 |
max_multiplier = text_words * 0.5
|
114 |
|
115 |
-
print(f"min tokens {int(min_multiplier)}, max tokens {int(max_multiplier)}")
|
116 |
inputs = tokenizer(
|
117 |
chunks,
|
118 |
max_length=model.config.max_position_embeddings,
|
|
|
45 |
|
46 |
if current_chunk:
|
47 |
chunks.append(current_chunk.strip())
|
|
|
48 |
return chunks
|
49 |
|
50 |
|
|
|
87 |
else:
|
88 |
sentence = load_text_file(uploaded_file)
|
89 |
st.write(f"{len(sentence)} characters and {len(sentence.split())} words")
|
90 |
+
#st.write(sentence)
|
91 |
|
92 |
with audioTab:
|
93 |
st.text("Yet to be implemented...")
|
|
|
97 |
|
98 |
with st.spinner("Generating Summary..."):
|
99 |
if button and sentence:
|
100 |
+
chunks = split_text_into_chunks(sentence, 10000)
|
101 |
+
print(f"Split into {len(chunks)} chunks")
|
102 |
|
103 |
text_words = len(sentence.split())
|
104 |
if summary_balance == "concise":
|
|
|
111 |
min_multiplier = text_words * 0.2
|
112 |
max_multiplier = text_words * 0.5
|
113 |
|
114 |
+
print(f"Tokenizer min tokens {int(min_multiplier)}, max tokens {int(max_multiplier)}")
|
115 |
inputs = tokenizer(
|
116 |
chunks,
|
117 |
max_length=model.config.max_position_embeddings,
|
data.txt
CHANGED
@@ -1 +1,8 @@
|
|
1 |
-
The Industrial Revolution,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
The Industrial Revolution, spanning the 18th and 19th centuries, was a transformative period that reshaped societies, economies, and cultures across the globe. Originating in Great Britain and later spreading worldwide, this pivotal era marked a significant departure from traditional modes of production and ushered in an era of unprecedented progress and development.
|
2 |
+
Prior to the Industrial Revolution, much of human labor relied on manual effort or the assistance of animals. However, with the advent of machinery and the utilization of steam power, industries were able to mechanize production processes, leading to a substantial increase in efficiency and productivity. This shift from manual labor to mechanization in factories and mills revolutionized manufacturing, accelerating the pace of industrialization and propelling societies into an era of rapid change.
|
3 |
+
One of the key industries transformed by the Industrial Revolution was agriculture. Innovations such as the seed drill, crop rotation techniques, and selective breeding methods revolutionized farming practices. These advancements significantly increased agricultural productivity and yielded surplus crops, resulting in improved living standards for many people. With the newfound abundance of food, populations grew, and individuals began migrating from rural areas to burgeoning urban centers in search of employment opportunities. The rise of urbanization became a defining characteristic of the Industrial Revolution, leading to the formation of sprawling cities and the concentration of populations in these industrial hubs.
|
4 |
+
In addition to agriculture, transportation systems underwent revolutionary changes during this period. The development of steam-powered locomotives and the construction of extensive railway networks facilitated the movement of goods and people over long distances. This transformation revolutionized trade, enabling faster and more efficient transportation of raw materials, finished products, and individuals. The establishment of railway and steamship networks fostered the growth of global trade, connecting regions economically and culturally and giving rise to a new era of interconnectedness.
|
5 |
+
Technological advancements played a critical role in driving the Industrial Revolution forward. Inventions such as the spinning jenny, power loom, steam engine, telegraph, and later the electric motor transformed industries, making production faster, more reliable, and cost-effective. These technological breakthroughs not only revolutionized manufacturing processes but also laid the foundation for subsequent advancements in communication, transportation, and medicine. The Industrial Revolution was a catalyst for innovation, fostering a culture of scientific and technological progress that has shaped the modern world.
|
6 |
+
The social and economic implications of the Industrial Revolution were profound. The rise of factories and urban centers created a new social class, the industrial working class. These workers often toiled under challenging conditions, facing long hours, low wages, and hazardous environments. The period witnessed the emergence of labor unions and the fight for workers' rights, leading to improved conditions and the gradual establishment of labor laws. The Industrial Revolution also played a crucial role in the growth of capitalism and the development of modern economic systems, with factory owners and entrepreneurs accumulating vast wealth and power.
|
7 |
+
The significance of the Industrial Revolution cannot be overstated. It propelled humanity into a new era of progress, transforming agrarian societies into industrialized nations. The revolution laid the groundwork for modern economies, technological advancements, and scientific discoveries that continue to shape our world today. By harnessing the power of machinery, the Industrial Revolution propelled humanity forward, revolutionizing the way we live, work, and interact, and setting the stage for the remarkable progress that followed.
|
8 |
+
In conclusion, the Industrial Revolution stands as a pivotal period in history, characterized by profound changes in technology, industry, and society. Its impact on agriculture, manufacturing, transportation, and innovation laid the foundation for the modern world. Through the advent of mechanization, the Industrial Revolution spurred remarkable advancements, improving living standards, increasing production capabilities, and expanding opportunities for countless individuals worldwide. This transformative era remains a testament to human ingenuity, resilience, and the ability to adapt and thrive in the face of unprecedented change.
|