File size: 1,324 Bytes
83d2c6a
 
5ebeb73
 
7ca72fb
67066cc
aef4add
 
 
3f5b634
 
5ebeb73
aef4add
83d2c6a
aef4add
83d2c6a
aef4add
83d2c6a
 
aef4add
83d2c6a
 
 
 
5ebeb73
 
aef4add
67f4e81
5ebeb73
aef4add
3f5b634
79016b7
aef4add
 
5ebeb73
aef4add
 
5ebeb73
aef4add
 
 
5ebeb73
 
954392c
5ebeb73
 
 
 
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
import os

import gradio as gr

from helper.gradio_config import css, theme
from helper.text.text_app import TextApp
from helper.utils import TrafficDataHandler
from tabs.about_tab import about_tab
from tabs.help_tab import help_tab
from tabs.htr_tool import htr_tool_tab
from tabs.stepwise_htr_tool import stepwise_htr_tool_tab

handler = TrafficDataHandler()

VERSION = "Demo version 0.0.2"

with gr.Blocks(title="Riksarkivet", theme=theme, css=css) as demo:
    with gr.Row():
        with gr.Column(scale=1):
            text_ip_output = gr.Markdown(VERSION)
        with gr.Column(scale=1):
            gr.Markdown(TextApp.title_markdown)
        with gr.Column(scale=1):
            gr.Markdown(TextApp.title_markdown_img)

    with gr.Tabs():
        with gr.Tab("Fast track"):
            htr_tool_tab.render()

        with gr.Tab("Stepwise"):
            stepwise_htr_tool_tab.render()

        with gr.Tab("Help"):
            help_tab.render()

        with gr.Tab("About"):
            about_tab.render()

    SECRET_KEY = os.environ.get("AM_I_IN_A_DOCKER_CONTAINER", False)
    if SECRET_KEY:
        demo.load(handler.onload_store_metric_data)


demo.queue(concurrency_count=2, max_size=2)


if __name__ == "__main__":
    demo.launch(server_name="0.0.0.0", server_port=7860, show_api=False, show_error=True)