Nuzz23 commited on
Commit
30e1cf5
·
1 Parent(s): 88c1f62

robust handler

Browse files
Files changed (2) hide show
  1. app.py +1 -2
  2. utils.py +1 -1
app.py CHANGED
@@ -1,4 +1,3 @@
1
- import traceback
2
  import gradio as gr
3
  import os
4
  import torch
@@ -64,7 +63,7 @@ def dataProcessing(file, timestamp_column: str = None):
64
  gr.update(visible=False), # processing_msg
65
  gr.update(visible=False, value=None), # plot_output
66
  gr.update(visible=False, value=None), # download_output
67
- gr.update(visible=True, value=f"❌ **Error:** {str(e)}\n\n```\n{traceback.format_exc()}\n```") # errorHandler
68
  )
69
 
70
 
 
 
1
  import gradio as gr
2
  import os
3
  import torch
 
63
  gr.update(visible=False), # processing_msg
64
  gr.update(visible=False, value=None), # plot_output
65
  gr.update(visible=False, value=None), # download_output
66
+ gr.update(visible=True, value=f"❌ **Error:** {str(e)}") # errorHandler
67
  )
68
 
69
 
utils.py CHANGED
@@ -328,7 +328,7 @@ def plotResults(df, target_cols:list[str]=None)->plt.Figure|None:
328
  ax.set_xlabel('Timestamp')
329
  ax.set_ylabel('Values')
330
  ax.grid(True, which='both', linestyle='--', linewidth=0.5)
331
- ax.set_xticks(df['temp_timestamp_for_print'][::max(1, len(df)//10)], labels=df['timestamp'][::max(1, len(df)//10)], rotation=45)
332
  plt.tight_layout()
333
  df.drop(columns=['temp_timestamp_for_print'], inplace=True)
334
  return fig # Return the figure object
 
328
  ax.set_xlabel('Timestamp')
329
  ax.set_ylabel('Values')
330
  ax.grid(True, which='both', linestyle='--', linewidth=0.5)
331
+ ax.set_xticks(df['temp_timestamp_for_print'][::max(1, len(df)//10)], labels=df['timestamp' if 'timestamp' in df.columns else 'temp_timestamp_for_print'][::max(1, len(df)//10)], rotation=45)
332
  plt.tight_layout()
333
  df.drop(columns=['temp_timestamp_for_print'], inplace=True)
334
  return fig # Return the figure object