marziehben commited on
Commit
8fef31c
·
verified ·
1 Parent(s): 3553922

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -14
app.py CHANGED
@@ -42,29 +42,22 @@ def predictPPM(df, split):
42
  print(predictions)
43
 
44
  #combine all into one table
45
- ts_df=df.copy()
46
- ts_df.rename(columns={'#PPM':'PPM'},inplace=True)
47
  train= ts_df[:int (len(ts_df)*ttSplit)]
48
  test= ts_df[int(len(ts_df)*ttSplit):]
49
 
50
  df2['Date']=pd.to_datetime(df2['Date'])
51
  df2.rename(columns={'#PPM':'PPM'},inplace=True)
52
- df3=predictions
53
- df2['origin']='ground truth'
54
  df3['origin']='prediction'
55
  df4=pd.concat([df2, df3])
56
  print(df4)
57
  return df4
58
-
59
- demo=gr.Interface(
60
- fn =predictPPM,inputs = [gr.Blocks(label="Input for the timeseries"),
61
  gr.Slider(1, 100, value=75, step=1, label="Train test split percentage"),
62
  ],
63
- outputs=[gr.LinePlot(x='Date', y='PPM', color='origin')#gr.Timeseries(x='Month')
64
-
65
- ],
66
- examples=[
67
- [os.path.join(os.path.abspath(''), "datappm.csv"), 75],
68
- ]
69
  )
70
- demo.launch()
 
42
  print(predictions)
43
 
44
  #combine all into one table
45
+ ts_df=df
 
46
  train= ts_df[:int (len(ts_df)*ttSplit)]
47
  test= ts_df[int(len(ts_df)*ttSplit):]
48
 
49
  df2['Date']=pd.to_datetime(df2['Date'])
50
  df2.rename(columns={'#PPM':'PPM'},inplace=True)
51
+ df3= predictions
52
+ df2['origin']='status '
53
  df3['origin']='prediction'
54
  df4=pd.concat([df2, df3])
55
  print(df4)
56
  return df4
57
+ demo = gr.Interface(
58
+ fn =predictPPM,inputs = [gr.UploadButton(label="Input data for PPM TimeSeries"),
 
59
  gr.Slider(1, 100, value=75, step=1, label="Train test split percentage"),
60
  ],
61
+ outputs=gr.LinePlot(x='Date', y='PPM', color='origin')
 
 
 
 
 
62
  )
63
+ demo.launch(debug=True)