Create bag.py
Browse files
bag.py
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# bag.py — Static strings for SEO, metadata, and video page
|
| 2 |
+
# All strings are exported as module-level variables for app.py to serve
|
| 3 |
+
|
| 4 |
+
BASE_URL = "https://build-small-hackathon-overthinker.hf.space"
|
| 5 |
+
|
| 6 |
+
# --- LLMs.txt ---
|
| 7 |
+
LLMS_TXT = f"""# Overthinker - Decision Tree Explorer
|
| 8 |
+
> A Hackathon project for Gradio's Build-small Hackathon. Explore complex decisions with AI-generated branches.
|
| 9 |
+
|
| 10 |
+
## Docs
|
| 11 |
+
- Decision Tree: {BASE_URL}/
|
| 12 |
+
- Upload Trace: {BASE_URL}/upload_trace
|
| 13 |
+
|
| 14 |
+
## Features
|
| 15 |
+
- AI-generated options and outcomes with full path context
|
| 16 |
+
- Export as SVG, JSON, Markdown, PNG
|
| 17 |
+
- Multi-user via SQLite per-session
|
| 18 |
+
- Hugging Face Datasets trace upload
|
| 19 |
+
|
| 20 |
+
## Contact
|
| 21 |
+
- Built by: broadfield-dev
|
| 22 |
+
- Repository: https://huggingface.co/spaces/build-small-hackathon/overthinker
|
| 23 |
+
"""
|
| 24 |
+
|
| 25 |
+
# --- Sitemap XML ---
|
| 26 |
+
SITEMAP_XML = f"""<?xml version="1.0" encoding="UTF-8"?>
|
| 27 |
+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
| 28 |
+
<url>
|
| 29 |
+
<loc>{BASE_URL}/</loc>
|
| 30 |
+
<lastmod>2026-06-14</lastmod>
|
| 31 |
+
<changefreq>weekly</changefreq>
|
| 32 |
+
<priority>1.0</priority>
|
| 33 |
+
</url>
|
| 34 |
+
<url>
|
| 35 |
+
<loc>{BASE_URL}/llms.txt</loc>
|
| 36 |
+
<changefreq>monthly</changefreq>
|
| 37 |
+
<priority>0.5</priority>
|
| 38 |
+
</url>
|
| 39 |
+
<url>
|
| 40 |
+
<loc>{BASE_URL}/overthinker.json</loc>
|
| 41 |
+
<changefreq>monthly</changefreq>
|
| 42 |
+
<priority>0.5</priority>
|
| 43 |
+
</url>
|
| 44 |
+
<url>
|
| 45 |
+
<loc>{BASE_URL}/video</loc>
|
| 46 |
+
<changefreq>never</changefreq>
|
| 47 |
+
<priority>0.3</priority>
|
| 48 |
+
</url>
|
| 49 |
+
</urlset>
|
| 50 |
+
"""
|
| 51 |
+
|
| 52 |
+
# --- Robots.txt ---
|
| 53 |
+
ROBOTS_TXT = f"""User-agent: *
|
| 54 |
+
Allow: /
|
| 55 |
+
Sitemap: {BASE_URL}/sitemap.xml
|
| 56 |
+
"""
|
| 57 |
+
|
| 58 |
+
# --- Overthinker JSON-LD ---
|
| 59 |
+
OVERSEER_JSON = f"""{{
|
| 60 |
+
"@context": "https://schema.org",
|
| 61 |
+
"@type": "WebApplication",
|
| 62 |
+
"name": "Overthinker",
|
| 63 |
+
"description": "AI-powered decision tree explorer that generates options and outcomes with full context from root.",
|
| 64 |
+
"url": "{BASE_URL}/",
|
| 65 |
+
"applicationCategory": "Productivity",
|
| 66 |
+
"operatingSystem": "Web",
|
| 67 |
+
"author": {{
|
| 68 |
+
"@type": "Person",
|
| 69 |
+
"name": "broadfield-dev"
|
| 70 |
+
}},
|
| 71 |
+
"offers": {{
|
| 72 |
+
"@type": "Offer",
|
| 73 |
+
"price": "0",
|
| 74 |
+
"priceCurrency": "USD"
|
| 75 |
+
}}
|
| 76 |
+
}}
|
| 77 |
+
"""
|
| 78 |
+
|
| 79 |
+
# --- Video Page HTML (placeholder for your video URL) ---
|
| 80 |
+
# Replace PLACEHOLDER_VIDEO_URL with your actual video link
|
| 81 |
+
VIDEO_PAGE_HTML = """<!DOCTYPE html>
|
| 82 |
+
<html lang="en">
|
| 83 |
+
<head>
|
| 84 |
+
<meta charset="UTF-8">
|
| 85 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 86 |
+
<title>Overthinker Demo Video</title>
|
| 87 |
+
<style>
|
| 88 |
+
* { margin: 0; padding: 0; box-sizing: border-box; }
|
| 89 |
+
body {
|
| 90 |
+
background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
|
| 91 |
+
min-height: 100vh;
|
| 92 |
+
display: flex;
|
| 93 |
+
flex-direction: column;
|
| 94 |
+
align-items: center;
|
| 95 |
+
justify-content: center;
|
| 96 |
+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
| 97 |
+
color: #fff;
|
| 98 |
+
padding: 2rem;
|
| 99 |
+
}
|
| 100 |
+
h1 {
|
| 101 |
+
font-size: 2.5rem;
|
| 102 |
+
margin-bottom: 1rem;
|
| 103 |
+
background: linear-gradient(45deg, #f093fb, #f5576c);
|
| 104 |
+
-webkit-background-clip: text;
|
| 105 |
+
-webkit-text-fill-color: transparent;
|
| 106 |
+
}
|
| 107 |
+
.video-container {
|
| 108 |
+
width: 100%;
|
| 109 |
+
max-width: 800px;
|
| 110 |
+
border-radius: 20px;
|
| 111 |
+
overflow: hidden;
|
| 112 |
+
box-shadow: 0 20px 60px rgba(0,0,0,0.5);
|
| 113 |
+
}
|
| 114 |
+
video {
|
| 115 |
+
width: 100%;
|
| 116 |
+
display: block;
|
| 117 |
+
}
|
| 118 |
+
.back-link {
|
| 119 |
+
margin-top: 2rem;
|
| 120 |
+
color: #a0a0ff;
|
| 121 |
+
text-decoration: none;
|
| 122 |
+
font-size: 1.2rem;
|
| 123 |
+
transition: 0.3s;
|
| 124 |
+
}
|
| 125 |
+
.back-link:hover {
|
| 126 |
+
color: #f5576c;
|
| 127 |
+
text-decoration: underline;
|
| 128 |
+
}
|
| 129 |
+
</style>
|
| 130 |
+
</head>
|
| 131 |
+
<body>
|
| 132 |
+
<h1>Overthinker Demo</h1>
|
| 133 |
+
<div class="video-container">
|
| 134 |
+
<video controls poster="/static/poster.jpg">
|
| 135 |
+
<source src="PLACEHOLDER_VIDEO_URL" type="video/mp4">
|
| 136 |
+
Your browser does not support the video tag.
|
| 137 |
+
</video>
|
| 138 |
+
</div>
|
| 139 |
+
<a href="/" class="back-link">← Back to Overthinker</a>
|
| 140 |
+
</body>
|
| 141 |
+
</html>
|
| 142 |
+
"""
|
| 143 |
+
|