Spaces:
Runtime error
Runtime error
Create examples/sample_texts.py
Browse files- examples/sample_texts.py +119 -0
examples/sample_texts.py
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
"""
|
| 3 |
+
Sample texts for testing and examples
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
SAMPLE_TEXTS = {
|
| 7 |
+
"business_report": """
|
| 8 |
+
Quarterly Business Performance Report
|
| 9 |
+
|
| 10 |
+
Our company has shown remarkable growth in Q3 2024, with revenue increasing by 25% compared to the previous quarter.
|
| 11 |
+
|
| 12 |
+
Key Achievements:
|
| 13 |
+
- Revenue reached $2.5 million, surpassing our target by 15%
|
| 14 |
+
- Customer acquisition increased by 40% with 1,200 new customers
|
| 15 |
+
- Employee satisfaction improved to 4.2/5.0
|
| 16 |
+
- Market share expanded to 12% in our target demographic
|
| 17 |
+
|
| 18 |
+
Challenges and Opportunities:
|
| 19 |
+
The main challenges we faced included supply chain disruptions and increased competition. However, these challenges have opened new opportunities for innovation and strategic partnerships.
|
| 20 |
+
|
| 21 |
+
Future Outlook:
|
| 22 |
+
We project continued growth in Q4, with an estimated revenue increase of 20%. Our focus will be on digital transformation and customer experience enhancement.
|
| 23 |
+
""",
|
| 24 |
+
|
| 25 |
+
"technology_overview": """
|
| 26 |
+
Artificial Intelligence: Transforming the Future
|
| 27 |
+
|
| 28 |
+
Artificial Intelligence (AI) is revolutionizing industries across the globe. From healthcare to finance, AI technologies are enabling unprecedented levels of automation and insight.
|
| 29 |
+
|
| 30 |
+
Key AI Technologies:
|
| 31 |
+
- Machine Learning: Algorithms that improve through experience
|
| 32 |
+
- Natural Language Processing: Understanding and generating human language
|
| 33 |
+
- Computer Vision: Interpreting and analyzing visual information
|
| 34 |
+
- Robotics: Physical AI systems that interact with the world
|
| 35 |
+
|
| 36 |
+
Current Applications:
|
| 37 |
+
AI is currently being used in medical diagnosis, autonomous vehicles, financial trading, and personalized recommendations. These applications are saving time, reducing costs, and improving outcomes.
|
| 38 |
+
|
| 39 |
+
Future Implications:
|
| 40 |
+
By 2030, AI is expected to contribute $13 trillion to the global economy. This transformation will create new job categories while making others obsolete, requiring significant workforce adaptation.
|
| 41 |
+
""",
|
| 42 |
+
|
| 43 |
+
"health_wellness": """
|
| 44 |
+
The Science of Healthy Living
|
| 45 |
+
|
| 46 |
+
Maintaining good health requires a holistic approach that encompasses physical activity, nutrition, mental well-being, and adequate rest.
|
| 47 |
+
|
| 48 |
+
Physical Activity Benefits:
|
| 49 |
+
- Reduces risk of heart disease by 35%
|
| 50 |
+
- Improves mental health and reduces anxiety
|
| 51 |
+
- Strengthens bones and muscles
|
| 52 |
+
- Enhances cognitive function
|
| 53 |
+
|
| 54 |
+
Nutrition Essentials:
|
| 55 |
+
A balanced diet should include 5-9 servings of fruits and vegetables daily, lean proteins, whole grains, and healthy fats. Proper hydration requires 8-10 glasses of water per day.
|
| 56 |
+
|
| 57 |
+
Mental Well-being:
|
| 58 |
+
Stress management through meditation, social connections, and hobby engagement significantly impacts overall health. Studies show that chronic stress can reduce life expectancy by 2-3 years.
|
| 59 |
+
|
| 60 |
+
Sleep Quality:
|
| 61 |
+
Adults need 7-9 hours of quality sleep nightly. Poor sleep is linked to obesity, diabetes, and cardiovascular disease.
|
| 62 |
+
""",
|
| 63 |
+
|
| 64 |
+
"environmental_impact": """
|
| 65 |
+
Climate Change: Understanding Our Environmental Impact
|
| 66 |
+
|
| 67 |
+
Climate change represents one of the most pressing challenges of our time, with global temperatures rising at an unprecedented rate.
|
| 68 |
+
|
| 69 |
+
Current Statistics:
|
| 70 |
+
- Global temperature has increased by 1.1°C since pre-industrial times
|
| 71 |
+
- CO2 levels have reached 415 ppm, the highest in 3 million years
|
| 72 |
+
- Arctic sea ice is declining at a rate of 13% per decade
|
| 73 |
+
- Ocean pH has decreased by 0.1 units due to acidification
|
| 74 |
+
|
| 75 |
+
Major Contributors:
|
| 76 |
+
Fossil fuel combustion accounts for 75% of greenhouse gas emissions. Deforestation contributes 18%, while agriculture and livestock produce 14% of global emissions.
|
| 77 |
+
|
| 78 |
+
Solutions and Actions:
|
| 79 |
+
Renewable energy adoption, energy efficiency improvements, sustainable transportation, and reforestation can significantly reduce our carbon footprint. Individual actions like reducing energy consumption and sustainable lifestyle choices also make a difference.
|
| 80 |
+
|
| 81 |
+
Future Projections:
|
| 82 |
+
Without intervention, global temperatures could rise by 3-5°C by 2100, causing severe ecological and economic disruption.
|
| 83 |
+
""",
|
| 84 |
+
|
| 85 |
+
"education_trends": """
|
| 86 |
+
The Future of Education: Digital Transformation
|
| 87 |
+
|
| 88 |
+
Education is undergoing a radical transformation driven by technology, changing student needs, and evolving workplace requirements.
|
| 89 |
+
|
| 90 |
+
Current Trends:
|
| 91 |
+
- Online learning has grown by 300% since 2020
|
| 92 |
+
- 73% of students prefer blended learning approaches
|
| 93 |
+
- Virtual reality is being used in 15% of educational institutions
|
| 94 |
+
- AI tutoring systems show 30% improvement in learning outcomes
|
| 95 |
+
|
| 96 |
+
Key Technologies:
|
| 97 |
+
Personalized learning platforms adapt to individual student needs. Virtual classrooms enable global collaboration. AI assessment tools provide instant feedback and identify learning gaps.
|
| 98 |
+
|
| 99 |
+
Skills for the Future:
|
| 100 |
+
Critical thinking, creativity, digital literacy, and emotional intelligence are becoming essential. Traditional memorization-based learning is being replaced by problem-solving and collaborative approaches.
|
| 101 |
+
|
| 102 |
+
Challenges and Opportunities:
|
| 103 |
+
Digital divide issues affect 21% of students globally. However, technology also democratizes access to quality education and enables lifelong learning opportunities.
|
| 104 |
+
"""
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
def get_sample_text(category: str = "business_report") -> str:
|
| 108 |
+
"""Get sample text by category"""
|
| 109 |
+
return SAMPLE_TEXTS.get(category, SAMPLE_TEXTS["business_report"])
|
| 110 |
+
|
| 111 |
+
def get_all_categories() -> list:
|
| 112 |
+
"""Get all available sample text categories"""
|
| 113 |
+
return list(SAMPLE_TEXTS.keys())
|
| 114 |
+
|
| 115 |
+
def get_random_sample() -> str:
|
| 116 |
+
"""Get a random sample text"""
|
| 117 |
+
import random
|
| 118 |
+
category = random.choice(list(SAMPLE_TEXTS.keys()))
|
| 119 |
+
return SAMPLE_TEXTS[category]
|