Lukeetah commited on
Commit
52c1a75
verified
1 Parent(s): 5e9bdc5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -37
app.py CHANGED
@@ -1,60 +1,41 @@
1
  import gradio as gr
2
  from modules.analyzer import UltraAnalyzer
3
- from modules.visualization import (
4
- create_consciousness_map,
5
- create_evolution_timeline,
6
- create_quantum_network,
7
- )
8
  from modules.fallback import minimal_response
9
 
10
- # Inicializaci贸n del analizador y estado global
11
  analyzer = UltraAnalyzer()
12
  history = []
13
 
14
  def main_interface(text, deep_mode=False):
15
- """Procesa la entrada del usuario y retorna respuesta y visualizaciones."""
16
  if not text.strip():
17
- return (
18
- minimal_response("Transmite tu pensamiento para iniciar."),
19
- None, None, None
20
- )
21
  try:
22
- result = analyzer.analyze(text, deep_mode=deep_mode)
23
  history.append(result)
24
- map_fig = create_consciousness_map(result)
25
- timeline_fig = create_evolution_timeline(result["future_scenarios"])
26
- network_fig = create_quantum_network(result)
27
- return result["response_md"], map_fig, timeline_fig, network_fig
 
 
28
  except Exception as e:
29
  return minimal_response(str(e)), None, None, None
30
 
31
- # Interfaz Gradio
32
- with gr.Blocks(
33
- title="Nexus Metamorphosis Ultra (PROD)",
34
- css="""
35
- .gradio-container { background: #000; color: #0ff; }
36
- .gr-button { background: #0ff; color: #000; font-weight: bold; }
37
- """
38
- ) as app:
39
  gr.Markdown("# 馃寣 Nexus Metamorphosis Ultra (PROD)")
40
  with gr.Row():
41
  inp = gr.Textbox(label="馃 Tu pensamiento")
42
  deep = gr.Checkbox(label="Modo profundo", value=False)
43
- submit = gr.Button("馃殌 Analizar")
44
  map_plot = gr.Plot(label="Mapa de Conciencia")
45
  timeline = gr.Plot(label="Timeline Evolutivo")
46
  network = gr.Plot(label="Red Cu谩ntica")
47
- output_md = gr.Markdown()
48
-
49
- submit.click(
50
- main_interface, [inp, deep],
51
- [output_md, map_plot, timeline, network],
52
- api_name="analyze"
53
- )
54
 
 
55
  if __name__ == "__main__":
56
- app.launch(
57
- server_name="0.0.0.0",
58
- server_port=7860,
59
- enable_queue=True
60
- )
 
1
  import gradio as gr
2
  from modules.analyzer import UltraAnalyzer
3
+ from modules.visualization import create_consciousness_map, create_evolution_timeline, create_quantum_network
 
 
 
 
4
  from modules.fallback import minimal_response
5
 
6
+ # Init
7
  analyzer = UltraAnalyzer()
8
  history = []
9
 
10
  def main_interface(text, deep_mode=False):
 
11
  if not text.strip():
12
+ return minimal_response("Transmite tu pensamiento."), None, None, None
 
 
 
13
  try:
14
+ result = analyzer.analyze(text, deep_mode)
15
  history.append(result)
16
+ return (
17
+ result["response_md"],
18
+ create_consciousness_map(result),
19
+ create_evolution_timeline(result["future_scenarios"]),
20
+ create_quantum_network(result)
21
+ )
22
  except Exception as e:
23
  return minimal_response(str(e)), None, None, None
24
 
25
+ # UI
26
+ with gr.Blocks(title="Nexus Metamorphosis Ultra (PROD)") as app:
 
 
 
 
 
 
27
  gr.Markdown("# 馃寣 Nexus Metamorphosis Ultra (PROD)")
28
  with gr.Row():
29
  inp = gr.Textbox(label="馃 Tu pensamiento")
30
  deep = gr.Checkbox(label="Modo profundo", value=False)
31
+ btn = gr.Button("馃殌 Analizar")
32
  map_plot = gr.Plot(label="Mapa de Conciencia")
33
  timeline = gr.Plot(label="Timeline Evolutivo")
34
  network = gr.Plot(label="Red Cu谩ntica")
35
+ out_md = gr.Markdown()
36
+
37
+ btn.click(main_interface, [inp, deep], [out_md, map_plot, timeline, network], api_name="analyze")
 
 
 
 
38
 
39
+ # Launch sin enable_queue
40
  if __name__ == "__main__":
41
+ app.launch(server_name="0.0.0.0", server_port=7860) # [10]