Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -402,8 +402,27 @@ num_to_show = st.number_input(
|
|
402 |
value=10,
|
403 |
)
|
404 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
405 |
# 搜索逻辑触发
|
406 |
-
if query:
|
407 |
with st.spinner("Searching..."):
|
408 |
# Encode the query
|
409 |
search_start_time = time.time()
|
@@ -496,15 +515,7 @@ if query:
|
|
496 |
# Sort the DataFrame based on the Date to make sure it's ordered
|
497 |
plot_df = plot_df.sort_values(by="Date")
|
498 |
|
499 |
-
|
500 |
-
summary_button = st.button("AI summary")
|
501 |
-
if summary_button:
|
502 |
-
ai_gen_start = time.time()
|
503 |
-
st.markdown('**AI Summary of 10 abstracts:**')
|
504 |
-
st.markdown(summarize_abstract(abstracts[:9], instructions=prompt))
|
505 |
-
total_ai_time = time.time()-ai_gen_start
|
506 |
-
st.markdown(f'**Time to generate summary:** {total_ai_time:.2f} s')
|
507 |
-
|
508 |
# Create a Plotly figure
|
509 |
fig = px.scatter(
|
510 |
plot_df,
|
@@ -538,3 +549,13 @@ if query:
|
|
538 |
|
539 |
# Show the pie chart in the Streamlit app
|
540 |
st.plotly_chart(fig, use_container_width=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
402 |
value=10,
|
403 |
)
|
404 |
|
405 |
+
st.markdown("""
|
406 |
+
<style>
|
407 |
+
div.stButton > button {
|
408 |
+
width: 710px; /* 设置按钮宽度 */
|
409 |
+
background-color: #007BFF; /* 蓝色背景 */
|
410 |
+
color: white; /* 按钮文字颜色 */
|
411 |
+
border: none; /* 去除边框 */
|
412 |
+
border-radius: 5px; /* 圆角按钮 */
|
413 |
+
padding: 10px; /* 内边距调整 */
|
414 |
+
cursor: pointer; /* 鼠标悬浮样式 */
|
415 |
+
}
|
416 |
+
div.stButton > button:hover {
|
417 |
+
background-color: #0056b3; /* 悬浮时更深的蓝色 */
|
418 |
+
}
|
419 |
+
</style>
|
420 |
+
""", unsafe_allow_html=True)
|
421 |
+
|
422 |
+
search_button = st.button("Search")
|
423 |
+
|
424 |
# 搜索逻辑触发
|
425 |
+
if query or search_button:
|
426 |
with st.spinner("Searching..."):
|
427 |
# Encode the query
|
428 |
search_start_time = time.time()
|
|
|
515 |
# Sort the DataFrame based on the Date to make sure it's ordered
|
516 |
plot_df = plot_df.sort_values(by="Date")
|
517 |
|
518 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
519 |
# Create a Plotly figure
|
520 |
fig = px.scatter(
|
521 |
plot_df,
|
|
|
549 |
|
550 |
# Show the pie chart in the Streamlit app
|
551 |
st.plotly_chart(fig, use_container_width=True)
|
552 |
+
|
553 |
+
prompt = st.text_area("Enter your summary prompt", value=LLM_prompt)
|
554 |
+
summary_button = st.button("AI summary")
|
555 |
+
if summary_button:
|
556 |
+
ai_gen_start = time.time()
|
557 |
+
st.markdown('**AI Summary of 10 abstracts:**')
|
558 |
+
st.markdown(summarize_abstract(abstracts[:9], instructions=prompt))
|
559 |
+
total_ai_time = time.time()-ai_gen_start
|
560 |
+
st.markdown(f'**Time to generate summary:** {total_ai_time:.2f} s')
|
561 |
+
|