Spaces:
Running
Running
burtenshaw
commited on
Commit
·
dca750b
1
Parent(s):
add71fd
make linkedin button clearer
Browse files- app.py +30 -5
- linkedin_logo.png +0 -0
app.py
CHANGED
@@ -55,7 +55,16 @@ def on_user_logged_in(token: gr.OAuthToken | None):
|
|
55 |
0, # question_idx
|
56 |
[], # user_answers
|
57 |
gr.update(visible=False), # certificate_img
|
58 |
-
gr.update(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
token, # user_token
|
60 |
]
|
61 |
else:
|
@@ -70,7 +79,15 @@ def on_user_logged_in(token: gr.OAuthToken | None):
|
|
70 |
0, # question_idx
|
71 |
[], # user_answers
|
72 |
gr.update(visible=False), # certificate_img
|
73 |
-
gr.update(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
None, # user_token
|
75 |
]
|
76 |
|
@@ -125,8 +142,8 @@ def create_linkedin_button(username: str, cert_url: str | None) -> str:
|
|
125 |
|
126 |
message = f"""
|
127 |
<a href="{button_url}" target="_blank" style="display: block; margin-top: 20px; text-align: center;">
|
128 |
-
<img src="
|
129 |
-
alt="LinkedIn Add to Profile button">
|
130 |
</a>
|
131 |
"""
|
132 |
return message
|
@@ -357,7 +374,15 @@ with gr.Blocks() as demo:
|
|
357 |
with gr.Row(variant="compact"):
|
358 |
status_text = gr.Markdown("")
|
359 |
certificate_img = gr.Image(type="pil", visible=False)
|
360 |
-
linkedin_btn = gr.HTML(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
361 |
|
362 |
with gr.Row(variant="compact"):
|
363 |
login_btn = gr.LoginButton(visible=True)
|
|
|
55 |
0, # question_idx
|
56 |
[], # user_answers
|
57 |
gr.update(visible=False), # certificate_img
|
58 |
+
gr.update(
|
59 |
+
visible=True,
|
60 |
+
value="""
|
61 |
+
<div style="text-align: center; padding: 20px; border: 2px dashed #ccc; border-radius: 10px; margin-top: 20px;">
|
62 |
+
<h3>🎯 Complete the Quiz to Unlock</h3>
|
63 |
+
<p>Once you finish the quiz and pass, you'll be able to add your certificate directly to your LinkedIn profile!</p>
|
64 |
+
<img src="linkedin_logo.png" alt="LinkedIn Add to Profile" style="width: 200px; height: 53px; opacity: 0.5;">
|
65 |
+
</div>
|
66 |
+
""",
|
67 |
+
), # linkedin_btn - now visible with explanatory text
|
68 |
token, # user_token
|
69 |
]
|
70 |
else:
|
|
|
79 |
0, # question_idx
|
80 |
[], # user_answers
|
81 |
gr.update(visible=False), # certificate_img
|
82 |
+
gr.update(
|
83 |
+
visible=True,
|
84 |
+
value="""
|
85 |
+
<div style="text-align: center; padding: 20px; border: 2px dashed #ccc; border-radius: 10px; margin-top: 20px;">
|
86 |
+
<h3>🔒 Login Required</h3>
|
87 |
+
<p>Please log in with your Hugging Face account to access the quiz and earn your LinkedIn certificate!</p>
|
88 |
+
</div>
|
89 |
+
""",
|
90 |
+
), # linkedin_btn - visible with login prompt
|
91 |
None, # user_token
|
92 |
]
|
93 |
|
|
|
142 |
|
143 |
message = f"""
|
144 |
<a href="{button_url}" target="_blank" style="display: block; margin-top: 20px; text-align: center;">
|
145 |
+
<img src="linkedin_logo.png"
|
146 |
+
alt="LinkedIn Add to Profile button" style="width: 300px; height: 80px;">
|
147 |
</a>
|
148 |
"""
|
149 |
return message
|
|
|
374 |
with gr.Row(variant="compact"):
|
375 |
status_text = gr.Markdown("")
|
376 |
certificate_img = gr.Image(type="pil", visible=False)
|
377 |
+
linkedin_btn = gr.HTML(
|
378 |
+
visible=True,
|
379 |
+
value="""
|
380 |
+
<div style="text-align: center; padding: 20px; border: 2px dashed #ccc; border-radius: 10px; margin-top: 20px;">
|
381 |
+
<h3>🔒 Login Required</h3>
|
382 |
+
<p>Please log in with your Hugging Face account to access the quiz and earn your LinkedIn certificate!</p>
|
383 |
+
</div>
|
384 |
+
""",
|
385 |
+
)
|
386 |
|
387 |
with gr.Row(variant="compact"):
|
388 |
login_btn = gr.LoginButton(visible=True)
|
linkedin_logo.png
ADDED
![]() |