Mushfi's picture
Update app.py
96ca348
raw
history blame
2.08 kB
import gradio as gr
import tensorflow as tf
import os
import numpy as np
import pandas as pd
def k():
return gr.update(value=None)
def predict_input_image(file):
df = pd.DataFrame(file)
return '0.1854984', '8.68441'
with gr.Blocks(title="Forecasting Geomagnetic Storms", css="") as demo:
with gr.Row():
textmd = gr.Markdown('''
# Forecasting Geomagnetic Storms
''')
with gr.Row():
with gr.Column(scale=1, min_width=600):
textmd1 = gr.Markdown('''
## Inputs
Solar wind data should be composed of solar-wind readings from the satellites, in the form of a csv file with the following columns:
bx_gse, by_gse, bz_gse, theta_gse, phi_gse, bx_gsm, by_gsm, bz_gsm, theta_gsm, phi_gsm, bt, density, speed, temperature, source
''')
file1 = gr.File(label="Solar Wind Data (7 days)")
textmd2 = gr.Markdown('''
The satellite positions data should be composed of the daily positions of the DSCOVR and ACE Spacecrafts in Geocentric Solar Ecliptic (GSE) Coordinates for projections in the XY, XZ, and YZ planes. The csv file should have the following columns:
gse_x, gse_y, gse_z
''')
file2 = gr.File(label="Satellite Positions Data (7 days)")
number = gr.inputs.Number(label="Latest Subspot Number")
with gr.Row():
clear_btn = gr.Button("Clear")
submit_btn = gr.Button("Submit", elem_id="warning", variant='primary')
#label = gr.outputs.Label(num_top_classes=4)
#label = gr.HTML(value="<div style='height:300px; border-width: 1px; border-color: #000000; border-radius: 5px;'></div>")
with gr.Column(scale=1, min_width=300):
textmd = gr.Markdown('''
## Outputs
Predicted value of the Disturbance Storm-Time Index (Dst) at time t hour and t+1 hour
''')
label1 = gr.outputs.Textbox(label="Dst value (t)")
label2 = gr.outputs.Textbox(label="Dst value (t+1)")
clear_btn.click(k, inputs=[], outputs=file1)
submit_btn.click(predict_input_image, inputs=file1, outputs=[label1, label2])
demo.launch(debug='True', share=True)