Spaces:
Sleeping
Sleeping
grapplerulrich
commited on
Commit
·
14029bd
1
Parent(s):
0e7333a
Show warning to users & error to dev
Browse files
app.py
CHANGED
@@ -68,6 +68,13 @@ def content_summary( url_id, content ):
|
|
68 |
|
69 |
return summary
|
70 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
def main():
|
72 |
st.title('Racoon Search')
|
73 |
query = st.text_input('Search query')
|
@@ -78,7 +85,7 @@ def main():
|
|
78 |
try:
|
79 |
results = search_results( query )
|
80 |
except Exception as exception:
|
81 |
-
|
82 |
return
|
83 |
|
84 |
number_of_results = len( results )
|
@@ -100,15 +107,11 @@ def main():
|
|
100 |
|
101 |
try:
|
102 |
content = get_url_content( result['link'] )
|
|
|
|
|
|
|
103 |
except Exception as exception:
|
104 |
-
|
105 |
-
progress_bar.progress( ( index + 1 ) / number_of_results )
|
106 |
-
continue
|
107 |
-
|
108 |
-
summary = content_summary( url_id, content )
|
109 |
-
|
110 |
-
for sentence in summary:
|
111 |
-
st.write(sentence['summary_text'])
|
112 |
|
113 |
progress_bar.progress( ( index + 1 ) / number_of_results )
|
114 |
|
|
|
68 |
|
69 |
return summary
|
70 |
|
71 |
+
def exception_notice( exception ):
|
72 |
+
query_params = st.experimental_get_query_params()
|
73 |
+
if 'debug' in query_params.keys() and query_params['debug'][0] == 'true':
|
74 |
+
st.exception(exception)
|
75 |
+
else:
|
76 |
+
st.warning(str(exception))
|
77 |
+
|
78 |
def main():
|
79 |
st.title('Racoon Search')
|
80 |
query = st.text_input('Search query')
|
|
|
85 |
try:
|
86 |
results = search_results( query )
|
87 |
except Exception as exception:
|
88 |
+
exception_notice(exception)
|
89 |
return
|
90 |
|
91 |
number_of_results = len( results )
|
|
|
107 |
|
108 |
try:
|
109 |
content = get_url_content( result['link'] )
|
110 |
+
summary = content_summary( url_id, content )
|
111 |
+
for sentence in summary:
|
112 |
+
st.write(sentence['summary_text'])
|
113 |
except Exception as exception:
|
114 |
+
exception_notice(exception)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
|
116 |
progress_bar.progress( ( index + 1 ) / number_of_results )
|
117 |
|