Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -207,7 +207,7 @@ if (st.session_state.rerun_button == "QUERYING") and (st.session_state["video_li
|
|
| 207 |
try:
|
| 208 |
yt_parser.query_comments(st.session_state['video_link'], st.session_state['max_comments'])
|
| 209 |
except googleapiclient.errors.HttpError:
|
| 210 |
-
st.error("Error: Unable to query comments,
|
| 211 |
st.stop()
|
| 212 |
except:
|
| 213 |
st.error("Error: Unable to query comments, incorrect YouTube URL or maximum \
|
|
@@ -215,12 +215,20 @@ if (st.session_state.rerun_button == "QUERYING") and (st.session_state["video_li
|
|
| 215 |
st.stop()
|
| 216 |
|
| 217 |
# Run formatting and models
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 224 |
# Set "QUERY COMPLETE" to bypass running this section on script re-run
|
| 225 |
st.session_state.rerun_button = "QUERY COMPLETE"
|
| 226 |
|
|
|
|
| 207 |
try:
|
| 208 |
yt_parser.query_comments(st.session_state['video_link'], st.session_state['max_comments'])
|
| 209 |
except googleapiclient.errors.HttpError:
|
| 210 |
+
st.error("Error: Unable to query comments, incorrect YouTube URL or check your API key.")
|
| 211 |
st.stop()
|
| 212 |
except:
|
| 213 |
st.error("Error: Unable to query comments, incorrect YouTube URL or maximum \
|
|
|
|
| 215 |
st.stop()
|
| 216 |
|
| 217 |
# Run formatting and models
|
| 218 |
+
try:
|
| 219 |
+
yt_parser.format_comments()
|
| 220 |
+
yt_parser.clean_comments()
|
| 221 |
+
yt_parser.run_sentiment_pipeline(sentiment_pipeline)
|
| 222 |
+
yt_parser.run_topic_modelling_pipeline(embedding_model,
|
| 223 |
+
nlp=spacy_nlp,
|
| 224 |
+
max_topics=st.session_state['max_topics'])
|
| 225 |
+
except ValueError:
|
| 226 |
+
st.error("Error: Oops there are not enough comments to analyse, please try a different video.")
|
| 227 |
+
st.stop()
|
| 228 |
+
except:
|
| 229 |
+
st.error("Error: Oops there's an issue on our end, please wait a moment and try again.")
|
| 230 |
+
st.stop()
|
| 231 |
+
|
| 232 |
# Set "QUERY COMPLETE" to bypass running this section on script re-run
|
| 233 |
st.session_state.rerun_button = "QUERY COMPLETE"
|
| 234 |
|