Spaces:
Running
Running
make all changes to mcp
Browse files
app.py
CHANGED
@@ -27,7 +27,7 @@ COURSE_TITLE = os.getenv("COURSE_TITLE", "AI Agents Fundamentals")
|
|
27 |
|
28 |
ds = load_dataset(EXAM_DATASET_ID, split="train")
|
29 |
|
30 |
-
DATASET_REPO_URL = "https://huggingface.co/datasets/
|
31 |
|
32 |
# Convert dataset to a list of dicts and randomly sort
|
33 |
quiz_data = ds.to_pandas().to_dict("records")
|
@@ -103,7 +103,7 @@ def create_linkedin_button(username: str, cert_url: str | None) -> str:
|
|
103 |
current_month = date.today().month
|
104 |
|
105 |
# Use the dataset certificate URL if available, otherwise fallback to default
|
106 |
-
certificate_url = cert_url or "https://huggingface.co/
|
107 |
|
108 |
linkedin_params = {
|
109 |
"startTask": "CERTIFICATION_NAME",
|
@@ -145,7 +145,7 @@ async def upload_certificate_to_hub(username: str, certificate_img) -> str:
|
|
145 |
upload_file,
|
146 |
path_or_fileobj=tmp.name,
|
147 |
path_in_repo=f"certificates/{username}/{date.today()}.png",
|
148 |
-
repo_id="
|
149 |
repo_type="dataset",
|
150 |
token=os.getenv("HF_TOKEN"),
|
151 |
)
|
@@ -153,7 +153,7 @@ async def upload_certificate_to_hub(username: str, certificate_img) -> str:
|
|
153 |
|
154 |
# Construct the URL to the image
|
155 |
cert_url = (
|
156 |
-
f"https://huggingface.co/datasets/
|
157 |
f"resolve/main/certificates/{username}/{date.today()}.png"
|
158 |
)
|
159 |
|
@@ -213,7 +213,7 @@ async def push_results_to_hub(
|
|
213 |
|
214 |
if cert_url is None:
|
215 |
gr.Warning("Certificate upload failed, but you still passed!")
|
216 |
-
cert_url = "https://huggingface.co/
|
217 |
|
218 |
# Create LinkedIn button
|
219 |
linkedin_button = create_linkedin_button(profile.username, cert_url)
|
|
|
27 |
|
28 |
ds = load_dataset(EXAM_DATASET_ID, split="train")
|
29 |
|
30 |
+
DATASET_REPO_URL = "https://huggingface.co/datasets/mcp-course/certificates"
|
31 |
|
32 |
# Convert dataset to a list of dicts and randomly sort
|
33 |
quiz_data = ds.to_pandas().to_dict("records")
|
|
|
103 |
current_month = date.today().month
|
104 |
|
105 |
# Use the dataset certificate URL if available, otherwise fallback to default
|
106 |
+
certificate_url = cert_url or "https://huggingface.co/mcp-course"
|
107 |
|
108 |
linkedin_params = {
|
109 |
"startTask": "CERTIFICATION_NAME",
|
|
|
145 |
upload_file,
|
146 |
path_or_fileobj=tmp.name,
|
147 |
path_in_repo=f"certificates/{username}/{date.today()}.png",
|
148 |
+
repo_id="mcp-course/certificates",
|
149 |
repo_type="dataset",
|
150 |
token=os.getenv("HF_TOKEN"),
|
151 |
)
|
|
|
153 |
|
154 |
# Construct the URL to the image
|
155 |
cert_url = (
|
156 |
+
f"https://huggingface.co/datasets/mcp-course/certificates/"
|
157 |
f"resolve/main/certificates/{username}/{date.today()}.png"
|
158 |
)
|
159 |
|
|
|
213 |
|
214 |
if cert_url is None:
|
215 |
gr.Warning("Certificate upload failed, but you still passed!")
|
216 |
+
cert_url = "https://huggingface.co/mcp-course"
|
217 |
|
218 |
# Create LinkedIn button
|
219 |
linkedin_button = create_linkedin_button(profile.username, cert_url)
|