Update app.py
Browse files
app.py
CHANGED
|
@@ -10,10 +10,21 @@ set_environment()
|
|
| 10 |
from tools import upload_file_to_bucket
|
| 11 |
from graph import generate_graph
|
| 12 |
|
|
|
|
|
|
|
| 13 |
# (Keep Constants as is)
|
| 14 |
# --- Constants ---
|
| 15 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
| 16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
| 18 |
"""
|
| 19 |
Fetches all questions, runs the BasicAgent on them, submits all answers,
|
|
@@ -196,6 +207,7 @@ with gr.Blocks() as demo:
|
|
| 196 |
)
|
| 197 |
|
| 198 |
if __name__ == "__main__":
|
|
|
|
| 199 |
print("\n" + "-"*30 + " App Starting " + "-"*30)
|
| 200 |
# Check for SPACE_HOST and SPACE_ID at startup for information
|
| 201 |
space_host_startup = os.getenv("SPACE_HOST")
|
|
|
|
| 10 |
from tools import upload_file_to_bucket
|
| 11 |
from graph import generate_graph
|
| 12 |
|
| 13 |
+
import re
|
| 14 |
+
|
| 15 |
# (Keep Constants as is)
|
| 16 |
# --- Constants ---
|
| 17 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
| 18 |
|
| 19 |
+
mport requests, logging, os
|
| 20 |
+
TEST_URL = "https://www.youtube.com/watch?v=L1vXCYZAYYM"
|
| 21 |
+
def test_youtube():
|
| 22 |
+
try:
|
| 23 |
+
r = requests.head(TEST_URL, timeout=8, allow_redirects=True)
|
| 24 |
+
logging.warning("YT status %s %s", r.status_code, r.url)
|
| 25 |
+
except Exception as e:
|
| 26 |
+
logging.error("YT check failed: %s", e)
|
| 27 |
+
|
| 28 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
| 29 |
"""
|
| 30 |
Fetches all questions, runs the BasicAgent on them, submits all answers,
|
|
|
|
| 207 |
)
|
| 208 |
|
| 209 |
if __name__ == "__main__":
|
| 210 |
+
test_youtube()
|
| 211 |
print("\n" + "-"*30 + " App Starting " + "-"*30)
|
| 212 |
# Check for SPACE_HOST and SPACE_ID at startup for information
|
| 213 |
space_host_startup = os.getenv("SPACE_HOST")
|