Spaces:
Running
Running
Johnyquest7
commited on
Update app.py
Browse files
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 |
-
#
|
46 |
try:
|
47 |
-
if isinstance(start_date,
|
48 |
-
start_date = datetime.
|
49 |
-
if isinstance(end_date,
|
50 |
-
end_date = datetime.
|
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")
|
117 |
-
end_date = gr.DateTime(label="End Date", value="2025-01-07 00:00:00")
|
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",
|