File size: 1,822 Bytes
acc66a1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64

#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