Johnyquest7 commited on
Commit
83b5f00
·
verified ·
1 Parent(s): 55a4f2f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -42,12 +42,12 @@ def pubmed_search(mesh_terms, email, start_date, end_date):
42
  if not mesh_terms or not email:
43
  return "Please provide MeSH terms and email.", None, None
44
 
45
- # Ensure time defaults to midnight if not provided
46
  try:
47
- if isinstance(start_date, str):
48
- start_date = datetime.strptime(start_date, "%Y-%m-%d %H:%M:%S")
49
- if isinstance(end_date, str):
50
- end_date = datetime.strptime(end_date, "%Y-%m-%d %H:%M:%S")
51
 
52
  start_date_str = start_date.strftime("%Y-%m-%d %H:%M:%S")
53
  end_date_str = end_date.strftime("%Y-%m-%d %H:%M:%S")
@@ -113,8 +113,8 @@ with gr.Blocks() as app:
113
  )
114
 
115
  with gr.Row():
116
- start_date = gr.DateTime(label="Start Date", value="2025-01-01 00:00:00") # Ensure midnight time
117
- end_date = gr.DateTime(label="End Date", value="2025-01-07 00:00:00") # Ensure midnight time
118
 
119
  email_input = gr.Textbox(
120
  label="Email",
 
42
  if not mesh_terms or not email:
43
  return "Please provide MeSH terms and email.", None, None
44
 
45
+ # Convert float timestamps to datetime objects
46
  try:
47
+ if isinstance(start_date, float):
48
+ start_date = datetime.fromtimestamp(start_date)
49
+ if isinstance(end_date, float):
50
+ end_date = datetime.fromtimestamp(end_date)
51
 
52
  start_date_str = start_date.strftime("%Y-%m-%d %H:%M:%S")
53
  end_date_str = end_date.strftime("%Y-%m-%d %H:%M:%S")
 
113
  )
114
 
115
  with gr.Row():
116
+ start_date = gr.DateTime(label="Start Date", value="2025-01-01 00:00:00")
117
+ end_date = gr.DateTime(label="End Date", value="2025-01-07 00:00:00")
118
 
119
  email_input = gr.Textbox(
120
  label="Email",