File size: 1,077 Bytes
5c01b87
711c0ff
2b61c31
5c01b87
2b61c31
 
 
0804c9d
711c0ff
2b61c31
 
 
711c0ff
2b61c31
 
711c0ff
 
81dcb15
 
5c01b87
81dcb15
 
 
 
 
 
 
711c0ff
 
81dcb15
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
27
28
29
30
31
32
33
34
35
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")
            btn_search.click(
                gen.generate,
                inputs=[txt_search],
                outputs=mem_results
            )

        # with gr.Row():
        #     img_output = gr.Image(label="Graph Visualization", type="filepath")  # Add an Image component

        #     # Trigger graph generation after JSON is generated
        #     mem_results.change(
        #         psychohistory.main,
        #         inputs=[mem_results],
        #         outputs=img_output
        #     )
        mem_results.change(
                psychohistory.main,
                inputs=[mem_results],
                outputs=None
            )

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