From 0ef6f9814d9a8ff725cd16957a9df154fbd7b7d2 Mon Sep 17 00:00:00 2001 From: kevin Date: Sat, 14 Jun 2025 17:01:29 -0400 Subject: [PATCH] primer commit --- ajax/get_tables.php | 52 +++++++++++++++++++++++++++++ config.php | 17 ++++++++++ list_tables.php | 58 ++++++++++++++++++++++++++++++++ process_model.php | 54 ++++++++++++++++++++++++++++++ register_model.php | 80 +++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 261 insertions(+) create mode 100644 ajax/get_tables.php create mode 100644 config.php create mode 100644 list_tables.php create mode 100644 process_model.php create mode 100644 register_model.php diff --git a/ajax/get_tables.php b/ajax/get_tables.php new file mode 100644 index 0000000..1f7161c --- /dev/null +++ b/ajax/get_tables.php @@ -0,0 +1,52 @@ +query("SELECT COUNT(*) FROM models")->fetchColumn(); + + $filtered = $total; + if ($where) { + $stmt = $pdo->prepare("SELECT COUNT(*) FROM models $where"); + $stmt->execute($params); + $filtered = $stmt->fetchColumn(); + } + + $sql = "SELECT id, name FROM models $where ORDER BY id DESC LIMIT :start, :len"; + $stmt = $pdo->prepare($sql); + foreach ($params as $k => $v) { + $stmt->bindValue($k, $v); + } + $stmt->bindValue(':start', $start, PDO::PARAM_INT); + $stmt->bindValue(':len', $len, PDO::PARAM_INT); + $stmt->execute(); + $data = $stmt->fetchAll(PDO::FETCH_ASSOC); + + echo json_encode([ + 'draw' => $draw, + 'recordsTotal' => $total, + 'recordsFiltered' => $filtered, + 'data' => $data + ]); +} catch (Exception $e) { + echo json_encode([ + 'draw' => 0, + 'recordsTotal' => 0, + 'recordsFiltered' => 0, + 'data' => [], + 'error' => $e->getMessage() + ]); +} diff --git a/config.php b/config.php new file mode 100644 index 0000000..50e8d32 --- /dev/null +++ b/config.php @@ -0,0 +1,17 @@ + PDO::ERRMODE_EXCEPTION, + PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, + PDO::ATTR_EMULATE_PREPARES => false, +]; +try { + $pdo = new PDO($dsn, $user, $pass, $options); +} catch (PDOException $e) { + die("Error conexión BD: " . $e->getMessage()); +} diff --git a/list_tables.php b/list_tables.php new file mode 100644 index 0000000..4a6ef55 --- /dev/null +++ b/list_tables.php @@ -0,0 +1,58 @@ + + + + + + + Listar Tablas + + + + + +
+
+
+

Modelos en la Base de Datos

+
+
+ + + + + + + +
NombreAcción
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/process_model.php b/process_model.php new file mode 100644 index 0000000..a5dbca5 --- /dev/null +++ b/process_model.php @@ -0,0 +1,54 @@ +prepare($sql); + $stmt->execute([ + $name, + $version, + $description, + $layers, + $model_size, + $model_file_path, + $train_date, + $accuracy, + $f1_score, + $hyperparams, + $dataset + ]); + + header('Location: register_model.php?success=1'); + exit; +} catch (Exception $e) { + header('Location: register_model.php?error=' . urlencode($e->getMessage())); + exit; +} diff --git a/register_model.php b/register_model.php new file mode 100644 index 0000000..0e2cd0b --- /dev/null +++ b/register_model.php @@ -0,0 +1,80 @@ + +✅ Modelo registrado exitosamente.'; +} elseif (isset($_GET['error'])) { + echo '
❌ ' . htmlspecialchars($_GET['error']) . '
'; +} +?> + + + + + + + Registrar Modelo IA + + + + +
+
+
+

Registrar Modelo de IA

+
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ +
+
+
+
+ + + + \ No newline at end of file