Miquel Farré
commited on
Commit
·
80bb3ea
1
Parent(s):
5d687a4
update
Browse files
app.py
CHANGED
|
@@ -47,15 +47,12 @@ def commit_signup(username: str, email: str, current_data: pd.DataFrame) -> Opti
|
|
| 47 |
os.unlink(tmp.name)
|
| 48 |
return str(e) # Return error message
|
| 49 |
|
| 50 |
-
def join_waitlist(
|
| 51 |
-
token: gr.OAuthToken | None,
|
| 52 |
-
profile: gr.OAuthProfile | None,
|
| 53 |
-
) -> str:
|
| 54 |
"""Add user to the SmolVLM2 iPhone waitlist with retry logic for concurrent updates"""
|
| 55 |
|
| 56 |
-
if
|
| 57 |
gr.Warning("Please log in to Hugging Face first!")
|
| 58 |
-
return
|
| 59 |
|
| 60 |
for attempt in range(MAX_RETRIES):
|
| 61 |
try:
|
|
@@ -75,7 +72,7 @@ def join_waitlist(
|
|
| 75 |
error = commit_signup(profile.username, profile.email, current_data)
|
| 76 |
|
| 77 |
if error is None: # Success
|
| 78 |
-
return "Thanks for joining the waitlist! We'll keep you updated on SmolVLM2 iPhone app."
|
| 79 |
|
| 80 |
# If we got a conflict error, retry
|
| 81 |
if "Conflict" in str(error) and attempt < MAX_RETRIES - 1:
|
|
@@ -91,7 +88,7 @@ def join_waitlist(
|
|
| 91 |
return "Sorry, something went wrong. Please try again later."
|
| 92 |
|
| 93 |
# Create the interface
|
| 94 |
-
with gr.Blocks() as demo:
|
| 95 |
gr.Markdown("""
|
| 96 |
# Join SmolVLM2 iPhone Waitlist 📱
|
| 97 |
Sign up to be notified when the SmolVLM2 iPhone app and source code are released.
|
|
@@ -110,8 +107,9 @@ with gr.Blocks() as demo:
|
|
| 110 |
|
| 111 |
join_button.click(
|
| 112 |
fn=join_waitlist,
|
|
|
|
| 113 |
outputs=output,
|
| 114 |
)
|
| 115 |
|
| 116 |
if __name__ == "__main__":
|
| 117 |
-
demo.launch(
|
|
|
|
| 47 |
os.unlink(tmp.name)
|
| 48 |
return str(e) # Return error message
|
| 49 |
|
| 50 |
+
def join_waitlist(profile: gr.OAuthProfile | None) -> str:
|
|
|
|
|
|
|
|
|
|
| 51 |
"""Add user to the SmolVLM2 iPhone waitlist with retry logic for concurrent updates"""
|
| 52 |
|
| 53 |
+
if profile is None:
|
| 54 |
gr.Warning("Please log in to Hugging Face first!")
|
| 55 |
+
return "Please log in with your Hugging Face account first!"
|
| 56 |
|
| 57 |
for attempt in range(MAX_RETRIES):
|
| 58 |
try:
|
|
|
|
| 72 |
error = commit_signup(profile.username, profile.email, current_data)
|
| 73 |
|
| 74 |
if error is None: # Success
|
| 75 |
+
return "Thanks for joining the waitlist! We'll keep you updated on SmolVLM2 iPhone app and source code release."
|
| 76 |
|
| 77 |
# If we got a conflict error, retry
|
| 78 |
if "Conflict" in str(error) and attempt < MAX_RETRIES - 1:
|
|
|
|
| 88 |
return "Sorry, something went wrong. Please try again later."
|
| 89 |
|
| 90 |
# Create the interface
|
| 91 |
+
with gr.Blocks(title="SmolVLM2 Waitlist") as demo:
|
| 92 |
gr.Markdown("""
|
| 93 |
# Join SmolVLM2 iPhone Waitlist 📱
|
| 94 |
Sign up to be notified when the SmolVLM2 iPhone app and source code are released.
|
|
|
|
| 107 |
|
| 108 |
join_button.click(
|
| 109 |
fn=join_waitlist,
|
| 110 |
+
inputs=gr.OAuthProfile(),
|
| 111 |
outputs=output,
|
| 112 |
)
|
| 113 |
|
| 114 |
if __name__ == "__main__":
|
| 115 |
+
demo.launch()
|