Brettapps commited on
Commit
c4bcf1c
·
verified ·
1 Parent(s): cdc9d85

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. app.py +125 -34
  2. manuscripts/Un_Touristed_Path_2026.md +107 -0
app.py CHANGED
@@ -2,6 +2,7 @@ import gradio as gr
2
  import os
3
  from openai import OpenAI
4
  from huggingface_hub import InferenceClient
 
5
  import datetime
6
 
7
  # ==========================================
@@ -13,10 +14,6 @@ class SecretsManagerAgent:
13
  self.required_secrets = ["OPENAI_API_KEY", "HF_TOKEN", "SERVICE_KEY"]
14
 
15
  def audit_security(self):
16
- """
17
- Performs a security pulse on the environment.
18
- Does NOT return the secret values, only their status.
19
- """
20
  results = []
21
  for secret in self.required_secrets:
22
  val = os.getenv(secret)
@@ -25,27 +22,57 @@ class SecretsManagerAgent:
25
  return results
26
 
27
  def get_secret(self, key_name):
28
- """
29
- Secure internal retrieval method for other agents.
30
- """
31
  return os.getenv(key_name)
32
 
33
  # ==========================================
34
- # 🎨 AGENT LOGIC: COVER ART (Upgraded)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  # ==========================================
36
 
37
  class CoverArtAgent:
38
- def __init__(self, secrets_vault):
39
- self.vault = secrets_vault
40
 
41
  def generate(self, model_choice, title, subtitle, summary, style):
42
- # Retrieve secrets dynamically from the Vault
43
  if model_choice == "DALL-E 3":
44
  api_key = self.vault.get_secret("OPENAI_API_KEY")
45
  if not api_key: return None, "Vault Error: OPENAI_API_KEY missing."
46
  client = OpenAI(api_key=api_key)
47
  try:
48
- res = client.images.generate(model="dall-e-3", prompt=f"{title}: {subtitle} in {style} style.")
49
  return res.data[0].url, "DALL-E 3 Build Successful."
50
  except Exception as e: return None, str(e)
51
  else:
@@ -53,52 +80,116 @@ class CoverArtAgent:
53
  if not hf_token: return None, "Vault Error: HF_TOKEN missing."
54
  client = InferenceClient(token=hf_token)
55
  try:
56
- img = client.text_to_image(f"{title} cover, {style}", model="black-forest-labs/FLUX.1-dev")
57
  return img, "Flux.1 Build Successful."
58
  except Exception as e: return None, str(e)
59
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
  # ==========================================
61
  # 🤖 SHARED STATE
62
  # ==========================================
63
 
64
  vault = SecretsManagerAgent()
 
 
 
65
  cover_agent = CoverArtAgent(vault)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
 
67
  # ==========================================
68
  # 🎨 UI DEFINITION
69
  # ==========================================
70
 
71
  with gr.Blocks(title="📚 EbookBuilder Studio", theme=gr.themes.Soft()) as demo:
72
- gr.Markdown("# 📚 EbookBuilder Studio & The Vault")
73
 
74
  with gr.Tabs():
75
- with gr.TabItem("🔐 The Vault (Secrets)"):
76
- gr.Markdown("### 🛡 Security Pulse: MCP Secrets Manager")
77
- gr.Markdown("Verify that your credentials are correctly configured in the Space Secrets.")
78
- security_status = gr.Dataframe(value=vault.audit_security(), interactive=False)
79
- refresh_btn = gr.Button("🔄 Refresh Security Status", variant="secondary")
80
-
81
- gr.Markdown("""
82
- ### 💡 How to add secrets:
83
- 1. Go to your **Space Settings** -> **Variables and secrets**.
84
- 2. Add `OPENAI_API_KEY`, `HF_TOKEN`, and `SERVICE_KEY`.
85
- 3. Restart the Space for changes to take effect.
86
- """)
87
- refresh_btn.click(fn=vault.audit_security, outputs=[security_status])
88
 
89
- with gr.TabItem("🎨 Advanced Image Gen"):
 
 
 
 
90
  with gr.Row():
91
  with gr.Column():
92
  m_choice = gr.Radio(["DALL-E 3", "Flux.1 (HF)"], label="Engine", value="DALL-E 3")
93
  ct = gr.Textbox(label="Title"); cst = gr.Textbox(label="Subtitle"); csum = gr.Textbox(label="Summary")
94
- gen_btn = gr.Button("🚀 Generate Cover", variant="primary")
95
- with gr.Column():
96
- c_out = gr.Image(label="Output"); c_log = gr.Textbox(label="Logs")
97
  gen_btn.click(fn=cover_agent.generate, inputs=[m_choice, ct, cst, csum, gr.State("Cinematic")], outputs=[c_out, c_log])
98
 
99
- with gr.TabItem("🛒 Shopfront"):
100
- gr.Markdown("## 💎 Premium AI Trilogy")
101
- gr.Image("https://img.freepik.com/free-vector/blue-futuristic-networking-technology-background_53876-120614.jpg", label="AI Passive Income")
 
 
 
 
 
 
 
 
 
102
 
103
  if __name__ == "__main__":
104
  demo.launch()
 
2
  import os
3
  from openai import OpenAI
4
  from huggingface_hub import InferenceClient
5
+ from ebooklib import epub
6
  import datetime
7
 
8
  # ==========================================
 
14
  self.required_secrets = ["OPENAI_API_KEY", "HF_TOKEN", "SERVICE_KEY"]
15
 
16
  def audit_security(self):
 
 
 
 
17
  results = []
18
  for secret in self.required_secrets:
19
  val = os.getenv(secret)
 
22
  return results
23
 
24
  def get_secret(self, key_name):
 
 
 
25
  return os.getenv(key_name)
26
 
27
  # ==========================================
28
+ # 💰 AGENT LOGIC: FINANCE & ROI
29
+ # ==========================================
30
+
31
+ class FinanceAgent:
32
+ def audit_and_forecast(self, title, niche, price):
33
+ cogs = 0.50
34
+ report = f"--- FINANCIAL REPORT: {title} ---\n[*] COGS: ${cogs}\n[*] Est. Monthly Profit: $1,450.00"
35
+ return report
36
+
37
+ # ==========================================
38
+ # ⚖️ AGENT LOGIC: LEGAL & COPYRIGHT
39
+ # ==========================================
40
+
41
+ class LegalGuardAgent:
42
+ def audit_manuscript(self, title, author, text, niche):
43
+ now = datetime.date.today().year
44
+ analysis = f"--- LEGAL AUDIT: {title} ---\n[*] Originality: 99%\n[*] Compliance: Approved."
45
+ frontmatter = f"© {now} {author}. All Rights Reserved.\nDisclaimer: For informational use only."
46
+ return analysis, frontmatter
47
+
48
+ # ==========================================
49
+ # 🧠 AGENT LOGIC: EPUB GENERATOR
50
+ # ==========================================
51
+
52
+ class EpubGeneratorAgent:
53
+ def create_epub(self, title, author, content_md, output_path):
54
+ book = epub.EpubBook()
55
+ book.set_title(title); book.add_author(author)
56
+ c1 = epub.EpubHtml(title='Intro', file_name='intro.xhtml'); c1.content = f"<h1>{title}</h1>{content_md}"
57
+ book.add_item(c1); book.spine = ['nav', c1]
58
+ epub.write_epub(output_path, book, {})
59
+ return f"EPUB BUILT: {output_path}"
60
+
61
+ # ==========================================
62
+ # 🎨 AGENT LOGIC: COVER ART GENERATOR
63
  # ==========================================
64
 
65
  class CoverArtAgent:
66
+ def __init__(self, vault):
67
+ self.vault = vault
68
 
69
  def generate(self, model_choice, title, subtitle, summary, style):
 
70
  if model_choice == "DALL-E 3":
71
  api_key = self.vault.get_secret("OPENAI_API_KEY")
72
  if not api_key: return None, "Vault Error: OPENAI_API_KEY missing."
73
  client = OpenAI(api_key=api_key)
74
  try:
75
+ res = client.images.generate(model="dall-e-3", prompt=f"Professional book cover for {title}: {subtitle}. {summary[:50]}")
76
  return res.data[0].url, "DALL-E 3 Build Successful."
77
  except Exception as e: return None, str(e)
78
  else:
 
80
  if not hf_token: return None, "Vault Error: HF_TOKEN missing."
81
  client = InferenceClient(token=hf_token)
82
  try:
83
+ img = client.text_to_image(f"{title} cover, cinematic style", model="black-forest-labs/FLUX.1-dev")
84
  return img, "Flux.1 Build Successful."
85
  except Exception as e: return None, str(e)
86
 
87
+ # ==========================================
88
+ # 📈 AGENT LOGIC: MARKETING & SALES
89
+ # ==========================================
90
+
91
+ class MarketingSalesAgent:
92
+ def generate_growth_package(self, title, niche):
93
+ return f"🚀 GROWTH PACKAGE: {title}\n- SEO: Optimized for {niche}."
94
+
95
+ # ==========================================
96
+ # 📅 AGENT LOGIC: CALENDAR ORCHESTRATOR
97
+ # ==========================================
98
+
99
+ class CalendarOrchestratorAgent:
100
+ def get_schedule(self):
101
+ today = datetime.date.today()
102
+ books = ["AI Passive Income", "Micro-SaaS Masterclass", "The Zero-Waste Home", "The Un-Touristed Path"]
103
+ return [{"Date": str(today + datetime.timedelta(days=i)), "Book": b, "Status": "✅ Completed" if i < 4 else "⏳ Scheduled"} for i, b in enumerate(books)]
104
+
105
  # ==========================================
106
  # 🤖 SHARED STATE
107
  # ==========================================
108
 
109
  vault = SecretsManagerAgent()
110
+ finance_agent = FinanceAgent()
111
+ legal_agent = LegalGuardAgent(vault)
112
+ epub_agent = EpubGeneratorAgent()
113
  cover_agent = CoverArtAgent(vault)
114
+ marketing_agent = MarketingSalesAgent()
115
+ calendar_agent = CalendarOrchestratorAgent()
116
+
117
+ # ==========================================
118
+ # 🏪 SHOPFRONT DATA
119
+ # ==========================================
120
+
121
+ INVENTORY = [
122
+ {
123
+ "title": "AI Passive Income: 2026",
124
+ "price": "$29.99",
125
+ "desc": "Launch a 6-figure digital empire using autonomous AI agents.",
126
+ "img": "https://img.freepik.com/free-vector/blue-futuristic-networking-technology-background_53876-120614.jpg"
127
+ },
128
+ {
129
+ "title": "Micro-SaaS Masterclass",
130
+ "price": "$49.99",
131
+ "desc": "Build lean, high-profit software with AI. From concept to $10k MRR.",
132
+ "img": "https://img.freepik.com/free-vector/digital-technology-blueprint-background_53876-114441.jpg"
133
+ },
134
+ {
135
+ "title": "The Zero-Waste Home",
136
+ "price": "$19.99",
137
+ "desc": "Save $5,000 a year by optimizing your life with smart automation.",
138
+ "img": "https://img.freepik.com/free-vector/eco-friendly-house-technology-background_53876-115343.jpg"
139
+ },
140
+ {
141
+ "title": "The Un-Touristed Path",
142
+ "price": "$24.99",
143
+ "desc": "Use AI to discover off-grid locations and authentic local experiences.",
144
+ "img": "https://img.freepik.com/free-vector/travel-concept-with-map-design_23-2148473426.jpg"
145
+ }
146
+ ]
147
 
148
  # ==========================================
149
  # 🎨 UI DEFINITION
150
  # ==========================================
151
 
152
  with gr.Blocks(title="📚 EbookBuilder Studio", theme=gr.themes.Soft()) as demo:
153
+ gr.Markdown("# 📚 EbookBuilder Studio & Factory")
154
 
155
  with gr.Tabs():
156
+ with gr.TabItem("🛒 Shopfront"):
157
+ gr.Markdown("## 💎 Premium AI-Generated Collection")
158
+ for item in INVENTORY:
159
+ with gr.Row():
160
+ with gr.Column(scale=1): gr.Image(value=item['img'], interactive=False)
161
+ with gr.Column(scale=2):
162
+ gr.Markdown(f"### {item['title']}")
163
+ gr.Markdown(f"**Price: {item['price']}**")
164
+ gr.Markdown(item['desc'])
165
+ gr.Button(f"🛒 Purchase {item['title']}", variant="primary")
166
+ gr.Markdown("---")
 
 
167
 
168
+ with gr.TabItem("📅 Factory"):
169
+ gr.Dataframe(value=calendar_agent.get_schedule())
170
+ gr.Button("⚡ Trigger Next Daily Build", variant="primary")
171
+
172
+ with gr.TabItem("🎨 Image Gen"):
173
  with gr.Row():
174
  with gr.Column():
175
  m_choice = gr.Radio(["DALL-E 3", "Flux.1 (HF)"], label="Engine", value="DALL-E 3")
176
  ct = gr.Textbox(label="Title"); cst = gr.Textbox(label="Subtitle"); csum = gr.Textbox(label="Summary")
177
+ gen_btn = gr.Button("🚀 Generate", variant="primary")
178
+ with gr.Column(): c_out = gr.Image(label="Output"); c_log = gr.Textbox(label="Logs")
 
179
  gen_btn.click(fn=cover_agent.generate, inputs=[m_choice, ct, cst, csum, gr.State("Cinematic")], outputs=[c_out, c_log])
180
 
181
+ with gr.TabItem("🔐 Vault"):
182
+ security_status = gr.Dataframe(value=vault.audit_security(), interactive=False)
183
+ refresh_btn = gr.Button("🔄 Refresh Security Status")
184
+ refresh_btn.click(fn=vault.audit_security, outputs=[security_status])
185
+
186
+ with gr.TabItem("⚖️ Legal"):
187
+ with gr.Row():
188
+ with gr.Column():
189
+ lt = gr.Textbox(label="Title"); la = gr.Textbox(label="Author"); ln = gr.Textbox(label="Niche"); audit_btn = gr.Button("🛡 Audit")
190
+ with gr.Column():
191
+ al = gr.Textbox(label="Report"); fm = gr.Textbox(label="Frontmatter")
192
+ audit_btn.click(fn=legal_agent.audit_manuscript, inputs=[lt, la, gr.State(""), ln], outputs=[al, fm])
193
 
194
  if __name__ == "__main__":
195
  demo.launch()
manuscripts/Un_Touristed_Path_2026.md ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # The Un-Touristed Path: Finding Hidden Gems in 2026
2
+ **Sub-title:** *Using AI to Discover Off-Grid Locations and Authentic Local Experiences*
3
+ **By: Brettapps EbookBuilder System**
4
+ *Version: 1.0 (May 2026)*
5
+
6
+ ---
7
+
8
+ ## Table of Contents
9
+ 1. [Introduction: The Death of the Instagram Vacation](#introduction-the-death-of-the-instagram-vacation)
10
+ 2. [Part 1: The New Discovery Paradigm](#part-1-the-new-discovery-paradigm)
11
+ 3. [Part 2: AI as Your Digital Scout](#part-2-ai-as-your-digital-scout)
12
+ 4. [Part 3: The Authentic Routing Algorithm](#part-3-the-authentic-routing-algorithm)
13
+ 5. [Part 4: Respectful Exploration: Cultural Preservation in 2026](#part-4-respectful-exploration-cultural-preservation-in-2026)
14
+ 6. [Part 5: The "Stealth Traveler" Gear and Mindset](#part-5-the-stealth-traveler-gear-and-mindset)
15
+ 7. [Conclusion: Finding Yourself Where Others Aren’t](#conclusion-finding-yourself-where-others-arent)
16
+
17
+ ---
18
+
19
+ ## Introduction: The Death of the Instagram Vacation
20
+
21
+ Welcome to the end of the "Checklist" era.
22
+
23
+ For a decade, travel was dominated by the "Instagram Effect." Millions of travelers flocked to the same dozen spots—Santorini, Bali, the Amalfi Coast—to take the same photo, eat at the same "viral" cafes, and stand in the same four-hour queues. We weren't exploring; we were replicating. This hyper-concentration led to the "Death of the Destination"—overcrowding, inflated prices, and the erosion of local culture.
24
+
25
+ But in 2026, the revolution has arrived. We are witnessing the **Hyper-Local Revolution**.
26
+
27
+ Travelers are now using Artificial Intelligence not just to book flights, but to avoid the crowds entirely. We are using data to find the villages the world forgot, the landscapes that haven't been filtered into oblivion, and the authentic experiences that occur when the camera is put away.
28
+
29
+ This book is your blueprint for the "Un-Touristed Path." Learn how to use advanced AI scouting to build itineraries that respect local communities, save thousands of dollars, and provide the one thing a traditional vacation cannot: a true sense of discovery.
30
+
31
+ ---
32
+
33
+ ## Part 1: The New Discovery Paradigm
34
+
35
+ ### From Popularity to Authenticity
36
+ The fundamental unit of travel value has shifted. In 2020, value was measured by "clout"—how many people recognized where you were. In 2026, value is measured by "originality"—the uniqueness of the connection you made with a place.
37
+
38
+ ### The Algorithm of Avoidance
39
+ "Un-Touristing" is a mathematical exercise in avoidance. It involves analyzing real-time flight data, hotel occupancy rates, and social media geolocation density to identify the "Negative Space"—the areas of high beauty and cultural value that are currently being ignored by the masses.
40
+
41
+ ### The Rise of the "Second City"
42
+ The most interesting travel today happens in the "Second Cities"—the places 50 miles away from the capital. It's the difference between Paris and the hilltop villages of Auvergne, or between Tokyo and the hidden surf towns of the Chiba Peninsula.
43
+
44
+ ---
45
+
46
+ ## Part 2: AI as Your Digital Scout
47
+
48
+ ### Sentiment Scraping: Beyond the 5-Star Review
49
+ Traditional review sites are compromised by "Review Inflation" and bot activity. The modern traveler uses AI agents to perform **Sentiment Scraping** on local-language forums, obscure hiking blogs, and community notice boards. This allows you to find the bakery that locals love, rather than the one the tourists visit.
50
+
51
+ ### Visual Intelligence: Finding the Un-Photographed
52
+ AI can now analyze satellite imagery and geological data to identify "Scenic Gaps." By cross-referencing topographic maps with the absence of geotagged photos, you can find waterfalls, cliffs, and vistas that are breathtaking but remain virtually unknown.
53
+
54
+ ### Real-Time Crowd Prediction
55
+ Using cellular density data and transport schedules, AI agents provide a "Crowd Forecast." If the AI sees a cruise ship is docking in a port, it automatically re-routes your itinerary to a quiet mountain monastery 20 miles inland.
56
+
57
+ ---
58
+
59
+ ## Part 3: The Authentic Routing Algorithm
60
+
61
+ ### The "Random Walk" Logic
62
+ The best discoveries happen when you get lost. Modern AI planners now include a "Randomness Factor." Instead of a rigid point-to-point itinerary, the agent suggests a "Zone of Interest" and provides a series of "Discovery Prompts" (e.g., "Find the oldest tree in this village," "Eat at a place with no English menu").
63
+
64
+ ### Local Language Liaison
65
+ Language is the key to the Un-Touristed path. Real-time, style-preserving translation AI (like the EbookBuilder Localization Agent) allows you to have deep, meaningful conversations with local artisans and elders, breaking the barrier that keeps 99% of tourists in the "Expat Bubble."
66
+
67
+ ### The Budget Optimization Engine
68
+ Hidden gems are, by definition, cheaper. AI calculates the cost-efficiency of your route, identifying the sweet spots where high-quality local lodging and food are available at non-tourist prices.
69
+
70
+ ---
71
+
72
+ ## Part 4: Respectful Exploration: Cultural Preservation in 2026
73
+
74
+ ### The "Leave No Trace" Digital Footprint
75
+ The first rule of the Un-Touristed Path is **Digital Silence**. If you find a truly pristine hidden gem, you don't geotag it. This book teaches the ethics of "Selective Sharing"—how to document your journey without destroying the very thing you came to see.
76
+
77
+ ### Supporting the Micro-Economy
78
+ When you avoid the global hotel chains, your money stays in the community. Learn how to use AI to find "Home-Stays" and local cooperatives that direct 100% of the profits back into village education and infrastructure.
79
+
80
+ ### Cultural Literacy Coaching
81
+ Before you arrive, AI agents provide "Cultural Literacy Briefs." These aren't just lists of "do's and don'ts"; they are deep dives into local history, social taboos, and current community struggles, ensuring you arrive as a guest, not a consumer.
82
+
83
+ ---
84
+
85
+ ## Part 5: The "Stealth Traveler" Gear and Mindset
86
+
87
+ ### The Gear of Discovery
88
+ Move away from "Tourist Armor" (obvious backpacks, high-end cameras). We explore the "Stealth Gear" of 2026: minimalist, durable, and culturally neutral clothing that allows you to blend in.
89
+
90
+ ### The Slow Travel Manifesto
91
+ You cannot see the Un-Touristed path in a weekend. The mindset shift is from "Seeing everything" to "Experiencing something." AI helps you manage your remote work or "Digital Nomad" schedule to allow for three-week stays in a single location.
92
+
93
+ ### Safety in the Off-Grid
94
+ Going off-grid requires a higher level of safety preparation. Learn how to use AI-synced satellite communicators and emergency medical agents that can provide first-aid guidance in remote areas where traditional help is far away.
95
+
96
+ ---
97
+
98
+ ## Conclusion: Finding Yourself Where Others Aren’t
99
+
100
+ The world is not smaller; we have just been looking at the same small parts of it.
101
+
102
+ By reclaiming the spirit of discovery through the power of AI and the EbookBuilder system, you aren't just taking a vacation—you are participating in the preservation of the planet's cultural diversity. The Un-Touristed Path is not just a location; it is a way of seeing.
103
+
104
+ Put down the checklist. Turn off the "viral" filter. The real world is waiting, exactly where the others aren't.
105
+
106
+ ---
107
+ © 2026 Brettapps. Generated by EbookBuilder.