Spaces:
Sleeping
Sleeping
Jobanpreet
commited on
Commit
•
0c53813
1
Parent(s):
9ceb199
Update app.py
Browse fileserror handling line 148
app.py
CHANGED
@@ -135,15 +135,19 @@ def main():
|
|
135 |
|
136 |
# Button to submit URL
|
137 |
if st.sidebar.button("Submit"):
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
|
|
|
|
|
|
|
|
147 |
|
148 |
|
149 |
paraphrase_text=st.text_area("Paraphrase:", value=session_state.paraphrase, height=400)
|
|
|
135 |
|
136 |
# Button to submit URL
|
137 |
if st.sidebar.button("Submit"):
|
138 |
+
try:
|
139 |
+
if url:
|
140 |
+
original_url = get_original_url(url)
|
141 |
+
match = re.match(r"https?://(?:www\.)?linkedin\.com/(posts|feed|pulse)/.*", original_url) # checking domain and url page (means it should only be a post nothing else like login page or something else)
|
142 |
+
|
143 |
+
if match:
|
144 |
+
session_state.paraphrase, session_state.keywords, session_state.take_aways, session_state.highlights = paraphrased_post(url)
|
145 |
+
|
146 |
+
else:
|
147 |
+
st.sidebar.error("Put a valid LinkedIn post URL only")
|
148 |
+
except (openai.BadRequestError, TypeError) as e:
|
149 |
+
st.sidebar.error("Put a valid LinkedIn post URL only")
|
150 |
+
|
151 |
|
152 |
|
153 |
paraphrase_text=st.text_area("Paraphrase:", value=session_state.paraphrase, height=400)
|