LiveFactCheck / app.jl
=
works
acc66a1
#using GenieFramework; Genie.loadapp(); up()
module App
using Main.MyController
include("lib/Transcriber.jl")
using .Transcriber
using GenieFramework, PlotlyBase
using Genie.Renderer.Html
### Initial example as Proof of Concept
function generate_color_html_text(video_id::String = "WVOvmHUu8Vw")
transcript = Transcriber.get_transcript_text(video_id)
transcript = Transcriber.chunk_text(transcript, 200)
factchecks = MyController.generate_factchecks(transcript)
return MyController.gradient_text(factchecks, 0.5)
end
@genietools
@app begin
@in process = false
@in url = "https://www.youtube.com/watch?v=qFEaTk--tZo"
@out transcription = ""
@in transcribe = false
#@in download = false
@out transcribing = false
#@out downloading = false
@onchange transcribe begin
@info "Transcribing $url"
transcribing = true
video_id = MyController.youtubeUrlToId(url)
transcription = generate_color_html_text(video_id)
transcribing = false
end
#@onchange download begin
# @info "Downloading $url"
# downloading = true
## TODO: download the transcription
# downloading = false
#end
end
function ui()
[
h2("Youtube video Fact-Checker")
input("url", :url, style="width:500px")
# button("Transcribe", @click("process = !process"))
button("Transcribe", @click("transcribing = true"), loading=:transcribing)
button("Download", @click("download = !download; downloading=true"), loading=:downloading)
h4("Transcription:")
p("{{transcription}}")
]
end
@page("/", "app.jl.html")
# Example route that uses gradient text
route("/gradient") do
message = "this is a message"
gradient_message = MyController.generate_example(message)
end
end