Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,7 +3,7 @@ import pandas as pd
|
|
| 3 |
import numpy as np
|
| 4 |
|
| 5 |
from src.Surveyor import Surveyor
|
| 6 |
-
|
| 7 |
|
| 8 |
|
| 9 |
@st.experimental_singleton(show_spinner=True, suppress_st_warning=True)
|
|
@@ -41,6 +41,39 @@ def show_survey_download(zip_file_name, survey_file_name, download_placeholder):
|
|
| 41 |
|
| 42 |
def survey_space(surveyor, download_placeholder):
|
| 43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
form = st.sidebar.form(key='survey_form')
|
| 45 |
research_keywords = form.text_input("Enter your research keywords:", key='research_keywords', value='')
|
| 46 |
max_search = form.number_input("num_papers_to_search", help="maximium number of papers to glance through - defaults to 20",
|
|
@@ -59,6 +92,7 @@ def survey_space(surveyor, download_placeholder):
|
|
| 59 |
|
| 60 |
submit = form.form_submit_button('Submit')
|
| 61 |
|
|
|
|
| 62 |
run_kwargs = {'surveyor':surveyor, 'download_placeholder':download_placeholder}
|
| 63 |
if submit:
|
| 64 |
if research_keywords != '':
|
|
@@ -66,6 +100,7 @@ def survey_space(surveyor, download_placeholder):
|
|
| 66 |
elif len(arxiv_ids):
|
| 67 |
run_kwargs.update({'arxiv_ids':arxiv_ids})
|
| 68 |
run_survey(**run_kwargs)
|
|
|
|
| 69 |
|
| 70 |
|
| 71 |
|
|
|
|
| 3 |
import numpy as np
|
| 4 |
|
| 5 |
from src.Surveyor import Surveyor
|
| 6 |
+
|
| 7 |
|
| 8 |
|
| 9 |
@st.experimental_singleton(show_spinner=True, suppress_st_warning=True)
|
|
|
|
| 41 |
|
| 42 |
def survey_space(surveyor, download_placeholder):
|
| 43 |
|
| 44 |
+
class KeywordsModel(BaseModel):
|
| 45 |
+
research_keywords: Optional[str] = Field(
|
| 46 |
+
'', description="Enter your research keywords:"
|
| 47 |
+
)
|
| 48 |
+
max_search: int = Field(
|
| 49 |
+
10, ge=1, le=50, multiple_of=1,
|
| 50 |
+
description="num_papers_to_search:"
|
| 51 |
+
)
|
| 52 |
+
num_papers: int = Field(
|
| 53 |
+
3, ge=1, le=8, multiple_of=1,
|
| 54 |
+
description="num_papers_to_select:"
|
| 55 |
+
)
|
| 56 |
+
class ArxivIDsModel(BaseModel):
|
| 57 |
+
arxiv_ids: Optional[List[str]] = Field(
|
| 58 |
+
[], max_items=8, regex=r"^[0-9]+\.[0-9]+$", description="Enter arxiv ids for your curated set of papers (e.g. 2205.12755, 2205.10937, ...):"
|
| 59 |
+
)
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
with st.sidebar.form(key="survey_keywords_form"):
|
| 63 |
+
session_data = sp.pydantic_input(key="keywords_input_model", model=KeywordsModel)
|
| 64 |
+
st.write('or')
|
| 65 |
+
session_data.update(sp.pydantic_input(key="arxiv_ids_input_model", model=ArxivIDsModel))
|
| 66 |
+
submit = st.form_submit_button(label="Submit")
|
| 67 |
+
|
| 68 |
+
run_kwargs = {'surveyor':surveyor, 'download_placeholder':download_placeholder}
|
| 69 |
+
if submit:
|
| 70 |
+
if session_data['research_keywords'] != '':
|
| 71 |
+
run_kwargs.update({'research_keywords':session_data['research_keywords'], 'max_search':max_search, 'num_papers':num_papers})
|
| 72 |
+
elif len(session_data['arxiv_ids']):
|
| 73 |
+
run_kwargs.update({'arxiv_ids':session_data['arxiv_ids']})
|
| 74 |
+
run_survey(**run_kwargs)
|
| 75 |
+
|
| 76 |
+
'''
|
| 77 |
form = st.sidebar.form(key='survey_form')
|
| 78 |
research_keywords = form.text_input("Enter your research keywords:", key='research_keywords', value='')
|
| 79 |
max_search = form.number_input("num_papers_to_search", help="maximium number of papers to glance through - defaults to 20",
|
|
|
|
| 92 |
|
| 93 |
submit = form.form_submit_button('Submit')
|
| 94 |
|
| 95 |
+
|
| 96 |
run_kwargs = {'surveyor':surveyor, 'download_placeholder':download_placeholder}
|
| 97 |
if submit:
|
| 98 |
if research_keywords != '':
|
|
|
|
| 100 |
elif len(arxiv_ids):
|
| 101 |
run_kwargs.update({'arxiv_ids':arxiv_ids})
|
| 102 |
run_survey(**run_kwargs)
|
| 103 |
+
'''
|
| 104 |
|
| 105 |
|
| 106 |
|