Skip to content

davidkonradov-netizen/NeuroOS-v-2.2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

NeuroOS-v-2.2

¡Perfecto, David! A continuación te envío todos los códigos organizados por archivo, más un README.md especial para subir a GitHub y ejecutar en Termux.


🧠 Proyecto: NeuroOS v2.2 – SARA

Red neuronal fractal + Chat local Qwen vía Ollama + CLI integrada.


📁 neuroos/fractal/main.py

#!/usr/bin/env python3 """ Red Neuronal Fractal 3-6-9 – SARA """ import numpy as np import matplotlib matplotlib.use('Agg') # Evita GUI en Termux import matplotlib.pyplot as plt import networkx as nx import os

class FractalSNN: def init(self, depth=3): self.depth = depth self.G = nx.DiGraph() self.build()

def build(self):
    def add_nodes(parent, d):
        if d == 0:
            return
        for i in range(3):
            child = f"{parent}-{i}"
            tipo = 'E' if i % 2 == 0 else 'I'
            self.G.add_node(child, tipo=tipo)
            peso = round(np.random.uniform(-1, 1), 2)
            self.G.add_edge(parent, child, weight=peso)
            add_nodes(child, d - 1)

    root = "SARA"
    self.G.add_node(root, tipo='E')
    add_nodes(root, self.depth)

def draw(self, filename="sara_fractal.png"):
    os.makedirs("output", exist_ok=True)
    pos = nx.spring_layout(self.G, k=0.8, iterations=50, seed=42)
    colors = ['green' if self.G.nodes[n]['tipo'] == 'E' else 'red' for n in self.G.nodes]
    weights = [self.G.edges[e]['weight'] for e in self.G.edges]
    plt.figure(figsize=(10, 7))
    nx.draw(
        self.G, pos, with_labels=True,
        node_color=colors, edge_color=weights,
        edge_cmap=plt.cm.coolwarm,
        node_size=400, font_size=6
    )
    plt.title("Red Neuronal Fractal 3-6-9 – SARA")
    plt.savefig(f"output/{filename}", dpi=150)
    plt.close()
    print(f"[✅] Imagen guardada → output/{filename}")

if name == "main": os.chdir(os.path.dirname(file)) FractalSNN().draw()


📁 neuroos/ai/qwen_llm.py

#!/usr/bin/env python3 """ Chat local con Qwen-1.8B vía Ollama """ import subprocess import shutil

def is_ollama_installed() -> bool: return shutil.which("ollama") is not None

def install_ollama(): print("[+] Instalando Ollama…") subprocess.run(["pkg", "install", "-y", "ollama"], check=True) subprocess.run(["ollama", "pull", "qwen:1.8b"], check=True)

def chat(prompt: str) -> str: if not is_ollama_installed(): install_ollama() try: output = subprocess.check_output(["ollama", "run", "qwen:1.8b", prompt], text=True) return output.strip() except subprocess.CalledProcessError as e: return f"[X] Error en Ollama: {e}" except Exception as e: return f"[X] Error general: {e}"

if name == "main": while True: try: user_input = input("🤖> ") if user_input.lower() in {"exit", "quit"}: break print(chat(user_input)) except KeyboardInterrupt: break


📁 neuroos/main.py

#!/usr/bin/env python3 """ NeuroOS v2.2 CLI — todo en uno """ import argparse from neuroos.fractal.main import FractalSNN from neuroos.ai.qwen_llm import chat

def cli(): parser = argparse.ArgumentParser(description="NeuroOS v2.2 – SARA") sub = parser.add_subparsers(dest="cmd") sub.add_parser("fractal", help="Generar red fractal 3-6-9") sub.add_parser("qwen", help="Chat local con Qwen-1.8B") sub.add_parser("sara", help="Lanzar SARA (Fractal + Chat)") args = parser.parse_args()

if args.cmd == "fractal":
    FractalSNN().draw()
elif args.cmd == "qwen":
    while True:
        try:
            msg = input("🤖> ")
            if msg.lower() in {"exit", "quit"}:
                break
            print(chat(msg))
        except KeyboardInterrupt:
            break
elif args.cmd == "sara":
    print("[+] Generando red fractal…")
    FractalSNN().draw()
    print("[+] Iniciando chat con SARA…")
    while True:
        try:
            msg = input("🤖 SARA> ")
            if msg.lower() in {"exit", "quit"}:
                break
            print(chat(msg))
        except KeyboardInterrupt:
            break
else:
    parser.print_help()

if name == "main": cli()


📁 install_termux.sh

#!/data/data/com.termux/files/usr/bin/bash set -e echo "[+] Instalando NeuroOS v2.2 en Termux…"

pkg update -y pkg install -y git python tigervnc podman x11-repo ollama

pip install --prefer-binary numpy matplotlib networkx websockets psutil

echo "[✅] Instalación completa. Ejecuta:" echo " cd ~/neuroos" echo " python neuroos/main.py sara"


📄 requirements.txt

numpy matplotlib networkx websockets psutil


📘 README.md (para GitHub)

🧠 NeuroOS v2.2 – SARA

Sistema operativo neuronal fractal con inteligencia artificial local.
Incluye visualización de red 3-6-9 y chat basado en Qwen 1.8B ejecutado por Ollama.

📦 Requisitos (en Termux)

pkg update -y
pkg install -y git python tigervnc podman x11-repo ollama
pip install numpy matplotlib networkx websockets psutil

🚀 Instalación

git clone https://github.com/tu_usuario/neuroos.git
cd neuroos
bash install_termux.sh
python neuroos/main.py sara

✨ Comandos CLI

python neuroos/main.py fractal → Genera red neuronal 3-6-9

python neuroos/main.py qwen → Inicia chat local Qwen-1.8B

python neuroos/main.py sara → Red fractal + chat



---

Desarrollado con ❤️ por David Conrado Cantillo
Versión: 2.2

---

### 📥 Archivo comprimido listo

Puedes descargar todo listo para copiar a Termux o subir a GitHub:

🔗 [Descargar neuroos_v2.2.zip](sandbox:/mnt/data/neuroos_v2.2.zip)

---

¿Deseas que lo suba yo a un repositorio privado/público por ti o que genere un QR para importar directo en Termux?

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published