Luis commited on
Commit
2e905cb
1 Parent(s): df944a0

set gradio outputs 10

Browse files
Files changed (3) hide show
  1. analysis_db.py +10 -4
  2. app.py +1 -2
  3. draw_db.py +1 -1
analysis_db.py CHANGED
@@ -13,11 +13,11 @@ def get_filename(file_obj):
13
  def read_db(db_file):
14
  db_name = get_filename(db_file)
15
  debug_print('read_db, db_name = ', db_name)
16
- return read_section(db_name, 'tb_section', '')
17
 
18
 
19
  def read_section(db_name, tb_name='tb_section'):
20
- res_fig = None
21
  debug_print('read_section, db_name = ', db_name, ', tb_name = ', tb_name)
22
  conn = sqlite3.connect(db_name)
23
 
@@ -34,13 +34,19 @@ def read_section(db_name, tb_name='tb_section'):
34
  section_date = section_row[1]
35
  section_end_date = section_row[2]
36
  section_mark = section_row[3]
 
37
  if section_mark == -1:
38
  print('section_id = ', section_id, ', section_date = ', str(section_date), ', section_end_date = ',
39
  str(section_end_date))
40
- res_fig = read_sample(conn, section_id, tb_name)
 
41
  conn.close()
42
 
43
- return res_fig
 
 
 
 
44
 
45
 
46
  def clamp(_value, _min, _max):
 
13
  def read_db(db_file):
14
  db_name = get_filename(db_file)
15
  debug_print('read_db, db_name = ', db_name)
16
+ return read_section(db_name, 'tb_section')
17
 
18
 
19
  def read_section(db_name, tb_name='tb_section'):
20
+ res = []
21
  debug_print('read_section, db_name = ', db_name, ', tb_name = ', tb_name)
22
  conn = sqlite3.connect(db_name)
23
 
 
34
  section_date = section_row[1]
35
  section_end_date = section_row[2]
36
  section_mark = section_row[3]
37
+
38
  if section_mark == -1:
39
  print('section_id = ', section_id, ', section_date = ', str(section_date), ', section_end_date = ',
40
  str(section_end_date))
41
+ plot = read_sample(conn, section_id, tb_name)
42
+ res.append(plot)
43
  conn.close()
44
 
45
+ for idx in range(10):
46
+ if idx >= len(res):
47
+ res.append(None)
48
+
49
+ return res
50
 
51
 
52
  def clamp(_value, _min, _max):
app.py CHANGED
@@ -10,11 +10,10 @@ def plot_pens(alpha):
10
  plt.scatter(x=df_pens['bill_length_mm'], y=df_pens['bill_depth_mm'])
11
  return fig
12
 
13
-
14
  iface = gr.Interface(
15
  fn=read_db,
16
  inputs=['file'],
17
- outputs=['plot'],
18
  title="Sleep Data test",
19
  description="Let's talk pens.",
20
  article="Talk more about Penguins here, shall we?",
 
10
  plt.scatter(x=df_pens['bill_length_mm'], y=df_pens['bill_depth_mm'])
11
  return fig
12
 
 
13
  iface = gr.Interface(
14
  fn=read_db,
15
  inputs=['file'],
16
+ outputs=['plot', 'plot', 'plot', 'plot', 'plot', 'plot', 'plot', 'plot', 'plot', 'plot'],
17
  title="Sleep Data test",
18
  description="Let's talk pens.",
19
  article="Talk more about Penguins here, shall we?",
draw_db.py CHANGED
@@ -39,7 +39,7 @@ def draw_lists(title='', date_list=None, **kv_list):
39
  idx_axs = int(idx_list / 3)
40
 
41
  plt.gcf().autofmt_xdate()
42
- # plt.title(title)
43
 
44
  if DEBUG:
45
  # plt.show()
 
39
  idx_axs = int(idx_list / 3)
40
 
41
  plt.gcf().autofmt_xdate()
42
+ axs[0].set_title(title)
43
 
44
  if DEBUG:
45
  # plt.show()