jiayong commited on
Commit
3224845
1 Parent(s): 1dd7b44

Update app.py

Browse files

add profile: gr.OAuthProfile

Files changed (1) hide show
  1. app.py +10 -1
app.py CHANGED
@@ -1,6 +1,7 @@
1
  import os
2
  import time
3
  import gradio as gr
 
4
  import threading
5
  from myconfigs import *
6
  from oss_utils import ossService
@@ -171,6 +172,13 @@ def refresh_video(uuid, request_id):
171
 
172
  return notes, new_list[0], new_list[1], new_list[2], new_list[3]#, new_image_list[0], new_image_list[1], new_image_list[2], new_image_list[3]
173
 
 
 
 
 
 
 
 
174
  with gr.Blocks(title = "Dreamoving",
175
  css='style.css',
176
  theme=gr.themes.Soft(
@@ -179,9 +187,10 @@ with gr.Blocks(title = "Dreamoving",
179
  )
180
  ) as demo:
181
  gr.Markdown(
182
- "Please login first."
183
  )
184
  gr.LoginButton()
 
185
  with gr.Row():
186
  gr.HTML(f"""
187
  <div id=css_img_dreamoving>
 
1
  import os
2
  import time
3
  import gradio as gr
4
+ from huggingface_hub import whoami
5
  import threading
6
  from myconfigs import *
7
  from oss_utils import ossService
 
172
 
173
  return notes, new_list[0], new_list[1], new_list[2], new_list[3]#, new_image_list[0], new_image_list[1], new_image_list[2], new_image_list[3]
174
 
175
+ def hello(profile: gr.OAuthProfile | None) -> str:
176
+ if profile is None:
177
+ return "I don't know you."
178
+ # print(gr.OAuthProfile)
179
+ print(f'profile name={profile.name}')
180
+ return f"Hello {profile.name}"
181
+
182
  with gr.Blocks(title = "Dreamoving",
183
  css='style.css',
184
  theme=gr.themes.Soft(
 
187
  )
188
  ) as demo:
189
  gr.Markdown(
190
+ "# Gradio OAuth Space\n\nThis Space is a demo for the new **Sign in with Hugging Face** feature."
191
  )
192
  gr.LoginButton()
193
+ demo.load(hello, inputs=None, outputs=m1)
194
  with gr.Row():
195
  gr.HTML(f"""
196
  <div id=css_img_dreamoving>