ZOTHEOS commited on
Commit
ce58fd6
Β·
verified Β·
1 Parent(s): 4923fb1

Update main_web.py

Browse files
Files changed (1) hide show
  1. main_web.py +78 -34
main_web.py CHANGED
@@ -1,4 +1,4 @@
1
- # FILE: main_web.py (Hugging Face Demo)
2
 
3
  import gradio as gr
4
  import asyncio
@@ -13,11 +13,10 @@ logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(name)s - %(level
13
  logger = logging.getLogger("ZOTHEOS_Interface_HF")
14
 
15
  def get_asset_path(filename: str) -> str:
16
- # In Hugging Face Spaces, assets are in the root or /assets
17
  return filename if os.path.exists(filename) else os.path.join('assets', filename)
18
 
19
  logo_path_verified = get_asset_path("zotheos_logo.png")
20
- GUMROAD_LINK = "https://zotheos.gumroad.com/l/jibfv"
21
 
22
  # --- Core Logic Imports ---
23
  try:
@@ -26,61 +25,106 @@ except ImportError:
26
  MainFusionPublic = None
27
  ai_system = MainFusionPublic() if MainFusionPublic else None
28
 
29
- # --- βœ… DEFINITIVE "OBSIDIAN" CSS THEME ---
30
  zotheos_web_css = """
31
  @import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Inter:wght@400;600;700&display=swap');
32
- body { background: linear-gradient(135deg, #000000, #1c1c1c) !important; font-family: 'Inter', sans-serif !important; }
33
- .gradio-container { background: transparent !important; max-width: 900px !important; }
34
- #header_logo img { max-height: 70px !important; filter: brightness(0) invert(1) !important; }
35
- #header_subtitle { font-family: 'Bebas Neue', cursive !important; font-size: 1.8rem !important; text-transform: uppercase !important; letter-spacing: 2px !important; }
36
- #header_tagline { color: #a0a0a0 !important; margin-top: -10px !important; margin-bottom: 1.5rem !important; }
37
- .gradio-textbox textarea { font-size: 1.1rem !important; }
38
- .result-box { background-color: rgba(18, 18, 18, 0.8) !important; border: 1px solid #333 !important; border-radius: 12px !important; padding: 1.5rem 2rem !important; }
39
- .result-box h2 { font-family: 'Bebas Neue', cursive !important; font-size: 1.5rem !important; border-bottom: 1px solid #333; padding-bottom: 0.75rem; margin-bottom: 1rem; }
40
- .cta-button { background: #FFFFFF !important; color: #000000 !important; font-weight: bold !important; }
41
- .cta-button:hover { background: #e0e0e0 !important; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  footer { display: none !important; }
43
  """
44
 
45
  # --- Build Gradio Interface ---
46
  def build_interface():
47
  zotheos_theme = gr.themes.Base(primary_hue=gr.themes.colors.neutral, secondary_hue=gr.themes.colors.neutral).set(
48
- button_primary_background_fill="white", button_primary_text_color="black"
49
  )
50
 
51
  with gr.Blocks(theme=zotheos_theme, css=zotheos_web_css, title=APP_TITLE) as demo:
52
- with gr.Column(elem_classes="gradio-container"):
53
- # --- βœ… UPGRADED HEADER WITH CALL TO ACTION ---
54
  gr.Image(value=logo_path_verified, elem_id="header_logo", show_label=False, container=False, interactive=False)
55
  gr.Markdown("Ethical Fusion AI for Synthesized Intelligence", elem_id="header_subtitle")
56
  gr.Markdown("Fusing perspectives for deeper truth.", elem_id="header_tagline")
57
-
58
  with gr.Accordion("πŸ”₯ Get the Full Offline Desktop Version", open=True):
59
  gr.Markdown("This web demo uses smaller, slower models. For the full-power, GPU-accelerated, 100% private experience, download the ZOTHEOS Public Beta for your Windows PC.")
60
- download_button = gr.Button("Download Full Version on Gumroad", link=GUMROAD_LINK, elem_classes="cta-button")
61
 
62
- gr.Markdown("---") # Separator
63
-
64
- # --- Main Interaction Area ---
65
- query_input = gr.Textbox(label="Your Inquiry:", placeholder="e.g., Analyze the ethical implications of AI in art...", lines=6)
66
  submit_button = gr.Button("Process Inquiry (Web Demo)", variant="primary")
67
 
68
- with gr.Column(visible=False) as results_box:
69
- gr.Markdown("## ✨ ZOTHEOS Final Synthesized Insight ✨")
70
- synthesized_summary_output = gr.Markdown()
71
- gr.Markdown("### πŸ’¬ Detailed Individual Perspectives")
72
- fusion_output = gr.Markdown()
73
 
74
- # --- Backend Logic ---
75
  async def process_query_wrapper(query):
76
  if not ai_system:
77
- return gr.update(visible=True), "[SYSTEM OFFLINE] The AI engine failed to load.", ""
78
 
 
 
 
79
  response = await ai_system.process_query_with_fusion(query)
80
- summary = response.split("###")[0].replace("## ✨ ZOTHEOS Final Synthesized Insight ✨", "").strip()
81
  perspectives = "###" + response.split("###", 1)[1] if "###" in response else ""
82
 
83
- return gr.update(visible=True), summary, perspectives
84
 
85
  submit_button.click(
86
  fn=process_query_wrapper,
@@ -91,7 +135,7 @@ def build_interface():
91
 
92
  # --- Main Execution Block ---
93
  if __name__ == "__main__":
94
- logger.info("--- Initializing ZOTHEOS Hugging Face Demo ---")
95
  zotheos_interface = build_interface()
96
- logger.info("βœ… HF Demo UI built.")
97
  zotheos_interface.queue().launch()
 
1
+ # FILE: main_web.py (Hugging Face Demo - FINAL, Mobile-First Pro Version)
2
 
3
  import gradio as gr
4
  import asyncio
 
13
  logger = logging.getLogger("ZOTHEOS_Interface_HF")
14
 
15
  def get_asset_path(filename: str) -> str:
 
16
  return filename if os.path.exists(filename) else os.path.join('assets', filename)
17
 
18
  logo_path_verified = get_asset_path("zotheos_logo.png")
19
+ GUMROAD_LINK = "https://zotheos.gumroad.com/l/jibfv" # Your actual Gumroad link
20
 
21
  # --- Core Logic Imports ---
22
  try:
 
25
  MainFusionPublic = None
26
  ai_system = MainFusionPublic() if MainFusionPublic else None
27
 
28
+ # --- βœ… DEFINITIVE "OBSIDIAN" MOBILE-FIRST CSS ---
29
  zotheos_web_css = """
30
  @import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Inter:wght@400;600;700&display=swap');
31
+
32
+ body {
33
+ background: linear-gradient(135deg, #000000, #1c1c1c) !important;
34
+ background-attachment: fixed !important;
35
+ color: #f0f0f0 !important;
36
+ font-family: 'Inter', sans-serif !important;
37
+ }
38
+ .gradio-container {
39
+ background: transparent !important;
40
+ max-width: 800px !important; /* Centered, comfortable width */
41
+ margin: 0 auto !important; /* Horizontally center the entire app */
42
+ padding: 1.5rem !important;
43
+ }
44
+ #main-column {
45
+ display: flex;
46
+ flex-direction: column;
47
+ align-items: center; /* Center all content horizontally */
48
+ width: 100%;
49
+ }
50
+ #header_logo img {
51
+ max-height: 70px !important;
52
+ filter: brightness(0) invert(1) !important;
53
+ margin-bottom: 0.5rem !important;
54
+ }
55
+ #header_subtitle {
56
+ font-family: 'Bebas Neue', cursive !important;
57
+ font-size: 1.8rem !important; text-transform: uppercase !important;
58
+ letter-spacing: 2px !important; text-align: center;
59
+ }
60
+ #header_tagline {
61
+ color: #a0a0a0 !important; text-align: center;
62
+ margin-top: -10px !important; margin-bottom: 2rem !important;
63
+ }
64
+ .gradio-accordion {
65
+ background-color: #1a1a1a !important; border: 1px solid #333 !important;
66
+ }
67
+ .cta-button {
68
+ background: #FFFFFF !important; color: #000000 !important;
69
+ font-weight: bold !important;
70
+ }
71
+ .gradio-textbox textarea {
72
+ font-size: 1.1rem !important;
73
+ }
74
+ #results_column { margin-top: 1.5rem; width: 100%; }
75
+ .result-box {
76
+ background-color: rgba(18, 18, 18, 0.9) !important;
77
+ border: 1px solid #333333 !important; padding: 1.5rem !important;
78
+ }
79
+ .result-box h2 {
80
+ font-family: 'Bebas Neue', cursive !important; font-size: 1.5rem !important;
81
+ border-bottom: 1px solid #333; padding-bottom: 0.75rem; margin-bottom: 1rem;
82
+ }
83
  footer { display: none !important; }
84
  """
85
 
86
  # --- Build Gradio Interface ---
87
  def build_interface():
88
  zotheos_theme = gr.themes.Base(primary_hue=gr.themes.colors.neutral, secondary_hue=gr.themes.colors.neutral).set(
89
+ button_primary_background_fill="white", button_primary_text_color="black", block_radius="12px"
90
  )
91
 
92
  with gr.Blocks(theme=zotheos_theme, css=zotheos_web_css, title=APP_TITLE) as demo:
93
+ with gr.Column(elem_id="main-column"):
94
+ # --- Header & CTA ---
95
  gr.Image(value=logo_path_verified, elem_id="header_logo", show_label=False, container=False, interactive=False)
96
  gr.Markdown("Ethical Fusion AI for Synthesized Intelligence", elem_id="header_subtitle")
97
  gr.Markdown("Fusing perspectives for deeper truth.", elem_id="header_tagline")
98
+
99
  with gr.Accordion("πŸ”₯ Get the Full Offline Desktop Version", open=True):
100
  gr.Markdown("This web demo uses smaller, slower models. For the full-power, GPU-accelerated, 100% private experience, download the ZOTHEOS Public Beta for your Windows PC.")
101
+ gr.Button("Download Full Version on Gumroad", link=GUMROAD_LINK, elem_classes="cta-button")
102
 
103
+ gr.Markdown("---")
104
+
105
+ # --- Main Interaction ---
106
+ query_input = gr.Textbox(label="Your Inquiry:", placeholder="e.g., What is universal peace?", lines=5)
107
  submit_button = gr.Button("Process Inquiry (Web Demo)", variant="primary")
108
 
109
+ with gr.Column(elem_id="results_column", visible=False) as results_box:
110
+ with gr.Column(elem_classes="result-box"):
111
+ synthesized_summary_output = gr.Markdown()
112
+ with gr.Column(elem_classes="result-box", elem_id="fusion_output"):
113
+ fusion_output = gr.Markdown()
114
 
115
+ # --- βœ… UNBREAKABLE EVENT HANDLER ---
116
  async def process_query_wrapper(query):
117
  if not ai_system:
118
+ return gr.update(visible=True), "## SYSTEM OFFLINE\n\n[The AI engine failed to load.]", ""
119
 
120
+ # Show a loading message
121
+ yield gr.update(visible=True), "Synthesizing... Please wait.", ""
122
+
123
  response = await ai_system.process_query_with_fusion(query)
124
+ summary = response.split("###")[0].strip()
125
  perspectives = "###" + response.split("###", 1)[1] if "###" in response else ""
126
 
127
+ yield gr.update(visible=True), summary, perspectives
128
 
129
  submit_button.click(
130
  fn=process_query_wrapper,
 
135
 
136
  # --- Main Execution Block ---
137
  if __name__ == "__main__":
138
+ logger.info("--- Initializing ZOTHEOS Hugging Face Demo (v2.1) ---")
139
  zotheos_interface = build_interface()
140
+ logger.info("βœ… HF Demo UI built successfully.")
141
  zotheos_interface.queue().launch()