events / app.py
cryptocalypse's picture
Update app.py
5f0b3bb verified
raw
history blame
1.65 kB
import gradio as gr
import gen
import psychohistory
with gr.Blocks(title="PSYCHOHISTORY") as app:
with gr.Tab("Search"):
with gr.Row():
model = gr.Radio(["Gemma2", "Zephy7B"], value="Gemma2",label="Model", info="Select model",scale=2)
time_direction = gr.Radio(["Past", "Future"], label="Direction", info="Select time direction",scale=2)
num_fut = gr.Textbox(value="4", label="Future Steps", scale=2)
with gr.Column():
spaces_include = gr.Checkbox(label="Hight", value=False)
spaces_include = gr.Checkbox(label="Medium", value=False)
spaces_include = gr.Checkbox(label="Low", value=False)
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():
img_output = gr.Image(label="Global Graph ", type="filepath") # Add an Image component
img_output2 = gr.Image(label="Most likely", type="filepath")
img_output3 = gr.Image(label="The slowest", type="filepath")
# Trigger graph generation after JSON is generated
with gr.Row():
mem_results = gr.JSON(label="Results")
btn_search.click(
gen.generate,
inputs=[txt_search],
outputs=mem_results
)
mem_results.change(
psychohistory.main,
inputs=[mem_results],
outputs=[img_output,img_output2,img_output3]
)
if __name__ == "__main__":
app.launch()