OK, I *think* that will do for now
This commit is contained in:
parent
7d54c2d7a5
commit
72458e5810
|
@ -1,6 +1,5 @@
|
||||||
(ns ireadit.routes.home
|
(ns ireadit.routes.home
|
||||||
(:require [ireadit.layout :as layout]
|
(:require [ireadit.layout :as layout]
|
||||||
[ireadit.views.form :refer :all]
|
|
||||||
[compojure.core :refer [defroutes GET]]
|
[compojure.core :refer [defroutes GET]]
|
||||||
[ring.util.http-response :as response]
|
[ring.util.http-response :as response]
|
||||||
[clojure.java.io :as io]))
|
[clojure.java.io :as io]))
|
||||||
|
|
|
@ -19,4 +19,4 @@
|
||||||
(POST "/ocr/:uri" []
|
(POST "/ocr/:uri" []
|
||||||
:return String
|
:return String
|
||||||
:path-params [uri :- String]
|
:path-params [uri :- String]
|
||||||
{:i-read (ocr (url-decode uri))}))))
|
(ok (ocr (url-decode uri)))))))
|
||||||
|
|
|
@ -22,8 +22,9 @@
|
||||||
|
|
||||||
(rf/reg-event-db
|
(rf/reg-event-db
|
||||||
:set-transcription
|
:set-transcription
|
||||||
(fn [db [_ transcription]]
|
(fn [db [_ response]]
|
||||||
(assoc db :transcription transcription)))
|
(js/console.log (str "Failed to fetch transcription data" response))
|
||||||
|
(assoc db :transcription response)))
|
||||||
|
|
||||||
(rf/reg-event-fx
|
(rf/reg-event-fx
|
||||||
:fetch-docs
|
:fetch-docs
|
||||||
|
|
|
@ -13,15 +13,22 @@
|
||||||
|
|
||||||
|
|
||||||
(defn form-page []
|
(defn form-page []
|
||||||
[:div.container {:id "main-container"}
|
[:div.container-fluid {:id "main-container"}
|
||||||
[:h1 "Transcribe the text of an image"]
|
[:h1 "Transcribe the text of an image"]
|
||||||
[:div
|
[:div
|
||||||
[:p.widget
|
[b/Row
|
||||||
[b/Label {:for "image-url" :title "URL of the image you wish to transcribe"}"Image URL"]
|
[:div.col-sm-3
|
||||||
|
[b/Label {:for "image-url" :title "URL of the image you wish to transcribe"}"Image URL"]]
|
||||||
|
[:div.col-sm-9
|
||||||
[b/Input {:id "image-url" :type "text" :size "80"
|
[b/Input {:id "image-url" :type "text" :size "80"
|
||||||
:on-change #(rf/dispatch [:set-url (.-value (.-target %))])}]]
|
:on-change #(rf/dispatch [:set-url (.-value (.-target %))])}]]]
|
||||||
[:p.widget
|
[b/Row
|
||||||
[b/Label {:for "send"} "To transcribe the image"]
|
[:div.col-sm-3
|
||||||
|
[b/Label {:for "send"} "To transcribe the image"]]
|
||||||
|
[:div.col-sm-9
|
||||||
[b/Button {:id "send" :on-click #(rf/dispatch [:fetch-transcription])} "Transcribe!"]]]
|
[b/Button {:id "send" :on-click #(rf/dispatch [:fetch-transcription])} "Transcribe!"]]]
|
||||||
[:div.transcription @(rf/subscribe [:transcription])]])
|
[b/Row]
|
||||||
|
[b/Row
|
||||||
|
[:div.col-sm-12
|
||||||
|
[b/Alert {:color "success"} @(rf/subscribe [:transcription])]]]]])
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue