Mushfi commited on
Commit
96ca348
·
1 Parent(s): 3c0c911

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +44 -0
app.py CHANGED
@@ -4,3 +4,47 @@ import os
4
  import numpy as np
5
  import pandas as pd
6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  import numpy as np
5
  import pandas as pd
6
 
7
+ def k():
8
+ return gr.update(value=None)
9
+
10
+ def predict_input_image(file):
11
+ df = pd.DataFrame(file)
12
+ return '0.1854984', '8.68441'
13
+
14
+ with gr.Blocks(title="Forecasting Geomagnetic Storms", css="") as demo:
15
+ with gr.Row():
16
+ textmd = gr.Markdown('''
17
+ # Forecasting Geomagnetic Storms
18
+ ''')
19
+ with gr.Row():
20
+ with gr.Column(scale=1, min_width=600):
21
+ textmd1 = gr.Markdown('''
22
+ ## Inputs
23
+ Solar wind data should be composed of solar-wind readings from the satellites, in the form of a csv file with the following columns:
24
+ 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
25
+ ''')
26
+ file1 = gr.File(label="Solar Wind Data (7 days)")
27
+ textmd2 = gr.Markdown('''
28
+ 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:
29
+ gse_x, gse_y, gse_z
30
+ ''')
31
+ file2 = gr.File(label="Satellite Positions Data (7 days)")
32
+ number = gr.inputs.Number(label="Latest Subspot Number")
33
+
34
+ with gr.Row():
35
+ clear_btn = gr.Button("Clear")
36
+ submit_btn = gr.Button("Submit", elem_id="warning", variant='primary')
37
+ #label = gr.outputs.Label(num_top_classes=4)
38
+ #label = gr.HTML(value="<div style='height:300px; border-width: 1px; border-color: #000000; border-radius: 5px;'></div>")
39
+ with gr.Column(scale=1, min_width=300):
40
+ textmd = gr.Markdown('''
41
+ ## Outputs
42
+ Predicted value of the Disturbance Storm-Time Index (Dst) at time t hour and t+1 hour
43
+ ''')
44
+ label1 = gr.outputs.Textbox(label="Dst value (t)")
45
+ label2 = gr.outputs.Textbox(label="Dst value (t+1)")
46
+
47
+ clear_btn.click(k, inputs=[], outputs=file1)
48
+ submit_btn.click(predict_input_image, inputs=file1, outputs=[label1, label2])
49
+
50
+ demo.launch(debug='True', share=True)