Spaces:
Sleeping
Sleeping
File size: 911 Bytes
5c01b87 711c0ff 2b61c31 5c01b87 2b61c31 711c0ff 2b61c31 711c0ff 2b61c31 711c0ff 5c01b87 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 |
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="Iran and Israel war", 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
)
if __name__ == "__main__":
app.launch()
|