Spaces:
mikitona
/
Running on Zero

mikitona commited on
Commit
9c66e69
·
verified ·
1 Parent(s): 8c1abdc

Update src/gradio_s3diff.py

Browse files
Files changed (1) hide show
  1. src/gradio_s3diff.py +6 -8
src/gradio_s3diff.py CHANGED
@@ -143,7 +143,7 @@ If S3Diff is helpful for you, please help star the GitHub Repo. Thanks!
143
  block = gr.Blocks().queue()
144
  with block:
145
  with gr.Row():
146
- gr.Markdown(MARKDOWN)
147
  with gr.Row():
148
  gr.LoginButton() # サインインボタンを追加
149
  with gr.Row():
@@ -160,12 +160,11 @@ with block:
160
  with gr.Column():
161
  result_image = gr.Image(label="Output", show_label=False, elem_id="result_image", width="100%", height="auto")
162
 
163
- # サインイン後に実行する関数や出力表示の設定
164
  with gr.Row():
165
- m1 = gr.Markdown()
166
- m2 = gr.Markdown()
167
- block.load(lambda profile: f"Hello {profile.name}" if profile else "Please log in", inputs=None, outputs=m1)
168
- block.load(lambda oauth_token: f"You belong to {', '.join([org['name'] for org in whoami(oauth_token.token)['orgs']])}" if oauth_token else "Log in to view organizations", inputs=None, outputs=m2)
169
 
170
  inputs = [
171
  input_image,
@@ -177,5 +176,4 @@ with block:
177
  ]
178
  run_button.click(fn=process, inputs=inputs, outputs=[result_image])
179
 
180
- block.launch()
181
-
 
143
  block = gr.Blocks().queue()
144
  with block:
145
  with gr.Row():
146
+ gr.Markdown(MARKDOWN) # 説明文
147
  with gr.Row():
148
  gr.LoginButton() # サインインボタンを追加
149
  with gr.Row():
 
160
  with gr.Column():
161
  result_image = gr.Image(label="Output", show_label=False, elem_id="result_image", width="100%", height="auto")
162
 
163
+ # サインイン後のユーザー名表示
164
  with gr.Row():
165
+ user_status = gr.Markdown() # 認証状態表示用のMarkdownコンポーネント
166
+ # サインインしたユーザー名を表示するためのロード関数
167
+ block.load(lambda profile: f"Hello, {profile.name}" if profile else "Please log in", inputs=None, outputs=user_status)
 
168
 
169
  inputs = [
170
  input_image,
 
176
  ]
177
  run_button.click(fn=process, inputs=inputs, outputs=[result_image])
178
 
179
+ block.launch()