Spaces:
Runtime error
Runtime error
fix: using oauth approach
Browse files
app.py
CHANGED
@@ -245,16 +245,19 @@ def vote(data: gr.LikeData):
|
|
245 |
]
|
246 |
jsonlfile.write("\n".join(json_data) + "\n")
|
247 |
|
248 |
-
def
|
249 |
global USERNAME
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
|
|
|
|
254 |
with gr.Blocks(css=CSS) as demo:
|
255 |
|
256 |
-
|
257 |
-
|
|
|
258 |
|
259 |
with gr.Row():
|
260 |
with gr.Column():
|
|
|
245 |
]
|
246 |
jsonlfile.write("\n".join(json_data) + "\n")
|
247 |
|
248 |
+
def hello(profile: gr.OAuthProfile | None) -> str:
|
249 |
global USERNAME
|
250 |
+
if profile is None:
|
251 |
+
USERNAME = "guest"
|
252 |
+
return "I don't know you."
|
253 |
+
USERNAME = profile.name
|
254 |
+
return f"Hello {profile.name}"
|
255 |
+
|
256 |
with gr.Blocks(css=CSS) as demo:
|
257 |
|
258 |
+
gr.LoginButton()
|
259 |
+
gr.LogoutButton()
|
260 |
+
gr.Markdown().attach_load_event(hello, None)
|
261 |
|
262 |
with gr.Row():
|
263 |
with gr.Column():
|