File size: 839 Bytes
5c01b87
711c0ff
2b61c31
5c01b87
2b61c31
 
 
0804c9d
711c0ff
2b61c31
 
42a21e8
2b61c31
711c0ff
2b61c31
 
711c0ff
42a21e8
711c0ff
 
42a21e8
711c0ff
5c01b87
 
711c0ff
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
import gradio as gr
import gen
import psychohistory

with gr.Blocks(title="PSYCHOHISTORY") as app:
    with gr.Tab("Search"):
        with gr.Row():
            txt_search = gr.Textbox(value="Peace in Eurasia in 2027", label="Search Term", scale=5)
            btn_search = gr.Button("Look", scale=1)
        with gr.Row():
            mem_results = gr.JSON(label="Results")
            html_output = gr.HTML(label="Graph Visualization") # Use HTML component
            btn_search.click(
                gen.generate,
                inputs=[txt_search],
                outputs=mem_results
            )
            mem_results.change(
                psychohistory.main,
                inputs=[mem_results],
                outputs=html_output  # Output to the HTML component
            )

if __name__ == "__main__":
    app.launch()