<commit_before>(ns lambdaui.core
  (:require
    [compojure.core :refer [routes GET context]]
    [lambdaui.api :as new-api]
    [lambdacd-git.core :as git]
    [lambdacd.core :as lambdacd]
    [lambdaui.simple-pipeline :as pipe]
    [lambdacd.runners :as runners]
    [org.httpkit.server :as http]
    [ring.middleware.json :as ring-json]
    [lambdacd.ui.api :as old-api]
    [lambdacd.ui.ui-page :as old-ui]
    [compojure.route :as route])
  (:gen-class)
  )

(defn try-parse-int [port default-fn]
  (try (Integer/parseInt port) (catch NumberFormatException e (default-fn e))))

(defonce server (atom nil))

(defn pipeline-routes [pipeline]
  (ring-json/wrap-json-response
    (routes (context "/lambdaui/api" [] (new-api/api-routes pipeline))
            (context "/api" [] (old-api/rest-api pipeline))
            (GET "/old" [] (old-ui/ui-page pipeline))
            (route/resources "/" {:root "public"}))))

(defn start-server [port]
  (git/init-ssh!)
  (let [pipeline (lambdacd/assemble-pipeline pipe/pipeline-structure {:home-dir "tmp/foo"})]
    (runners/start-one-run-after-another pipeline)
    (reset! server (http/run-server (pipeline-routes pipeline) {:port port}))))

(defn -main [& [portArg]]
  (let [port (try-parse-int portArg (fn [] (when portArg (println "Port '" portArg "' is not a number. Using default port")) 8081))]
    (println "Started Server on port " port ". CTRL+C to abort.")
    (start-server port)))<commit_msg>add new ui index html again for heroku<commit_after>(ns lambdaui.core
  (:require
    [compojure.core :refer [routes GET context]]
    [lambdaui.api :as new-api]
    [lambdacd-git.core :as git]
    [lambdacd.core :as lambdacd]
    [lambdaui.simple-pipeline :as pipe]
    [lambdacd.runners :as runners]
    [org.httpkit.server :as http]
    [ring.middleware.json :as ring-json]
    [lambdacd.ui.api :as old-api]
    [lambdacd.ui.ui-page :as old-ui]
    [compojure.route :as route])
  (:gen-class)
  )

(defn try-parse-int [port default-fn]
  (try (Integer/parseInt port) (catch NumberFormatException e (default-fn e))))

(defonce server (atom nil))

(defn pipeline-routes [pipeline]
  (ring-json/wrap-json-response
    (routes (context "/lambdaui/api" [] (new-api/api-routes pipeline))
            (context "/api" [] (old-api/rest-api pipeline))
            (GET "/old" [] (old-ui/ui-page pipeline))
            (route/resources "/" {:root "public"})
            (route/resources "/ui" {:root "public/target"})
            )))

(defn start-server [port]
  (git/init-ssh!)
  (let [pipeline (lambdacd/assemble-pipeline pipe/pipeline-structure {:home-dir "tmp/foo"})]
    (runners/start-one-run-after-another pipeline)
    (reset! server (http/run-server (pipeline-routes pipeline) {:port port}))))

(defn -main [& [portArg]]
  (let [port (try-parse-int portArg (fn [] (when portArg (println "Port '" portArg "' is not a number. Using default port")) 8081))]
    (println "Started Server on port " port ". CTRL+C to abort.")
    (start-server port)))
{'fraction_non_alphanumeric': 0.16566466265865062, 'fraction_numerical': 0.0026720106880427524, 'mean_word_length': 3.2785714285714285, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1050972', 'n_tokens_mistral': 1112, 'n_tokens_neox': 1078, 'n_words': 262}