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
|
||||
(:require [ireadit.layout :as layout]
|
||||
[ireadit.views.form :refer :all]
|
||||
[compojure.core :refer [defroutes GET]]
|
||||
[ring.util.http-response :as response]
|
||||
[clojure.java.io :as io]))
|
||||
|
|
|
@ -19,4 +19,4 @@
|
|||
(POST "/ocr/:uri" []
|
||||
:return String
|
||||
:path-params [uri :- String]
|
||||
{:i-read (ocr (url-decode uri))}))))
|
||||
(ok (ocr (url-decode uri)))))))
|
||||
|
|
|
@ -22,8 +22,9 @@
|
|||
|
||||
(rf/reg-event-db
|
||||
:set-transcription
|
||||
(fn [db [_ transcription]]
|
||||
(assoc db :transcription transcription)))
|
||||
(fn [db [_ response]]
|
||||
(js/console.log (str "Failed to fetch transcription data" response))
|
||||
(assoc db :transcription response)))
|
||||
|
||||
(rf/reg-event-fx
|
||||
:fetch-docs
|
||||
|
|
|
@ -13,15 +13,22 @@
|
|||
|
||||
|
||||
(defn form-page []
|
||||
[:div.container {:id "main-container"}
|
||||
[:div.container-fluid {:id "main-container"}
|
||||
[:h1 "Transcribe the text of an image"]
|
||||
[:div
|
||||
[:p.widget
|
||||
[b/Label {:for "image-url" :title "URL of the image you wish to transcribe"}"Image URL"]
|
||||
[b/Row
|
||||
[: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"
|
||||
:on-change #(rf/dispatch [:set-url (.-value (.-target %))])}]]
|
||||
[:p.widget
|
||||
[b/Label {:for "send"} "To transcribe the image"]
|
||||
:on-change #(rf/dispatch [:set-url (.-value (.-target %))])}]]]
|
||||
[b/Row
|
||||
[: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!"]]]
|
||||
[: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