events / app.py
neuralworm's picture
plotly instead of matplotlib
42a21e8
raw
history blame
839 Bytes
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()