Update app.py
Browse files
app.py
CHANGED
|
@@ -70,14 +70,119 @@ def analyze_sentiment(text):
|
|
| 70 |
return probabilities.cpu().numpy()[0]
|
| 71 |
|
| 72 |
def generate_website_content():
|
| 73 |
-
# Generate
|
| 74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
|
| 76 |
-
# Generate main content
|
| 77 |
-
content = generate_text("A short paragraph about
|
| 78 |
|
| 79 |
-
# Generate an image
|
| 80 |
-
image = generate_image("An
|
| 81 |
|
| 82 |
# Analyze sentiment of the content
|
| 83 |
sentiment = analyze_sentiment(content)
|
|
@@ -91,7 +196,6 @@ def generate_website_content():
|
|
| 91 |
layout = random.choice(layouts)
|
| 92 |
|
| 93 |
return title, content, image, sentiment_label, color, layout
|
| 94 |
-
|
| 95 |
def update_website():
|
| 96 |
title, content, image, sentiment, color, layout = generate_website_content()
|
| 97 |
|
|
|
|
| 70 |
return probabilities.cpu().numpy()[0]
|
| 71 |
|
| 72 |
def generate_website_content():
|
| 73 |
+
# Generate a random topic
|
| 74 |
+
topics = [
|
| 75 |
+
"space exploration",
|
| 76 |
+
"artificial intelligence",
|
| 77 |
+
"environmental conservation",
|
| 78 |
+
"quantum computing",
|
| 79 |
+
"renewable energy",
|
| 80 |
+
"climate change",
|
| 81 |
+
"biotechnology",
|
| 82 |
+
"nanotechnology",
|
| 83 |
+
"cybersecurity",
|
| 84 |
+
"robotics",
|
| 85 |
+
"virtual reality and augmented reality",
|
| 86 |
+
"autonomous vehicles",
|
| 87 |
+
"genetic engineering",
|
| 88 |
+
"3D printing and additive manufacturing",
|
| 89 |
+
"internet of things (IoT)",
|
| 90 |
+
"blockchain technology",
|
| 91 |
+
"sustainable agriculture",
|
| 92 |
+
"smart cities",
|
| 93 |
+
"digital health and telemedicine",
|
| 94 |
+
"renewable energy storage solutions",
|
| 95 |
+
"advanced materials science",
|
| 96 |
+
"space tourism",
|
| 97 |
+
"machine learning and data science",
|
| 98 |
+
"oceanography and marine conservation",
|
| 99 |
+
"AI ethics and governance",
|
| 100 |
+
"futuristic urban planning",
|
| 101 |
+
"exoplanet discovery and research",
|
| 102 |
+
"space colonization",
|
| 103 |
+
"artificial general intelligence (AGI)",
|
| 104 |
+
"human-computer interaction",
|
| 105 |
+
"sustainable architecture",
|
| 106 |
+
"nuclear fusion research",
|
| 107 |
+
"environmental impact of technology",
|
| 108 |
+
"astrobiology",
|
| 109 |
+
"bioinformatics",
|
| 110 |
+
"synthetic biology",
|
| 111 |
+
"renewable energy grid integration",
|
| 112 |
+
"environmental policy and legislation",
|
| 113 |
+
"human augmentation and enhancement",
|
| 114 |
+
"climate engineering (geoengineering)",
|
| 115 |
+
"space mining",
|
| 116 |
+
"high-performance computing (HPC)",
|
| 117 |
+
"sustainable transportation",
|
| 118 |
+
"energy harvesting technologies",
|
| 119 |
+
"cognitive computing",
|
| 120 |
+
"deep learning and neural networks",
|
| 121 |
+
"zero-waste living",
|
| 122 |
+
"astrophysics and cosmology",
|
| 123 |
+
"environmental education and awareness",
|
| 124 |
+
"sustainable water management",
|
| 125 |
+
"green technology innovation",
|
| 126 |
+
"impact of AI on employment",
|
| 127 |
+
"ethical hacking",
|
| 128 |
+
"space weather and its impacts",
|
| 129 |
+
"personalized medicine",
|
| 130 |
+
"advanced prosthetics and bionics",
|
| 131 |
+
"circular economy",
|
| 132 |
+
"environmental justice",
|
| 133 |
+
"human-robot collaboration",
|
| 134 |
+
"artificial intelligence in art and creativity",
|
| 135 |
+
"space telescopes and observatories",
|
| 136 |
+
"AI in climate modeling",
|
| 137 |
+
"renewable energy microgrids",
|
| 138 |
+
"sustainable fashion",
|
| 139 |
+
"quantum cryptography",
|
| 140 |
+
"asteroid deflection strategies",
|
| 141 |
+
"energy-efficient computing",
|
| 142 |
+
"wildlife conservation and habitat preservation",
|
| 143 |
+
"genomic editing and CRISPR",
|
| 144 |
+
"big data analytics",
|
| 145 |
+
"ethics in genetic engineering",
|
| 146 |
+
"sustainable fisheries and aquaculture",
|
| 147 |
+
"urban resilience to climate change",
|
| 148 |
+
"AI in healthcare diagnostics",
|
| 149 |
+
"space debris management",
|
| 150 |
+
"eco-friendly packaging solutions",
|
| 151 |
+
"AI in financial markets",
|
| 152 |
+
"conservation technology",
|
| 153 |
+
"interplanetary communication systems",
|
| 154 |
+
"green building certifications (e.g., LEED)",
|
| 155 |
+
"AI-powered drug discovery",
|
| 156 |
+
"sustainable mining practices",
|
| 157 |
+
"remote sensing for environmental monitoring",
|
| 158 |
+
"space-based solar power",
|
| 159 |
+
"conservation of endangered species",
|
| 160 |
+
"AI in supply chain optimization",
|
| 161 |
+
"sustainable product design",
|
| 162 |
+
"space habitat design",
|
| 163 |
+
"regenerative agriculture",
|
| 164 |
+
"quantum teleportation",
|
| 165 |
+
"sustainable tourism",
|
| 166 |
+
"AI-driven autonomous systems",
|
| 167 |
+
"carbon capture and storage (CCS)",
|
| 168 |
+
"resilient infrastructure development",
|
| 169 |
+
"planetary defense initiatives",
|
| 170 |
+
"sustainable energy policies",
|
| 171 |
+
"AI in language translation",
|
| 172 |
+
"space medicine",
|
| 173 |
+
"sustainable waste management",
|
| 174 |
+
"advanced robotics in manufacturing"
|
| 175 |
+
]
|
| 176 |
+
topic = random.choice(topics)
|
| 177 |
+
|
| 178 |
+
# Generate website title based on the topic
|
| 179 |
+
title = generate_text(f"A unique website title about {topic}:").split(':')[-1].strip()
|
| 180 |
|
| 181 |
+
# Generate main content based on the topic
|
| 182 |
+
content = generate_text(f"A short paragraph about {topic}:").split(':')[-1].strip()
|
| 183 |
|
| 184 |
+
# Generate an image based on the topic
|
| 185 |
+
image = generate_image(f"An artistic representation of {topic}")
|
| 186 |
|
| 187 |
# Analyze sentiment of the content
|
| 188 |
sentiment = analyze_sentiment(content)
|
|
|
|
| 196 |
layout = random.choice(layouts)
|
| 197 |
|
| 198 |
return title, content, image, sentiment_label, color, layout
|
|
|
|
| 199 |
def update_website():
|
| 200 |
title, content, image, sentiment, color, layout = generate_website_content()
|
| 201 |
|