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"],value="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=True,info="Probabilities") spaces_include = gr.Checkbox(label="Medium", value=True) spaces_include = gr.Checkbox(label="Low", value=True) 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="Predicted Futures",scale=2) # Futures predicted mem_results2 = gr.JSON(label="Radians Slow Path",scale=1) mem_results3 = gr.JSON(label="Radians Best Path",scale=1) #counter_results = gr.JSON(label="Counter Activity") # Wich activities are against the event #dark_results = gr.JSON(label="Dark Forces") #Who makes not happend 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]#,mem_results2,mem_results3] ) if __name__ == "__main__": app.launch()