Spaces:
mikitona
/
Running on Zero

mikitona commited on
Commit
8c1abdc
·
verified ·
1 Parent(s): 94f7fcd

Update src/gradio_s3diff.py

Browse files
Files changed (1) hide show
  1. src/gradio_s3diff.py +10 -2
src/gradio_s3diff.py CHANGED
@@ -139,14 +139,17 @@ MARKDOWN = \
139
  If S3Diff is helpful for you, please help star the GitHub Repo. Thanks!
140
  """
141
 
 
142
  block = gr.Blocks().queue()
143
  with block:
144
  with gr.Row():
145
  gr.Markdown(MARKDOWN)
 
 
146
  with gr.Row():
147
  with gr.Column():
148
  input_image = gr.Image(type="pil")
149
- run_button = gr.Button("Run") # `label="Run"` を削除してボタンのテキストを直接渡す
150
 
151
  with gr.Accordion("Options", open=True):
152
  cfg_scale = gr.Slider(label="Classifier Free Guidance Scale (Set a value larger than 1 to enable it!)", minimum=1.0, maximum=1.1, value=1.07, step=0.01)
@@ -155,9 +158,14 @@ with block:
155
  latent_tiled_overlap = gr.Slider(label="Tile Overlap", minimum=16, maximum=48, value=32, step=1)
156
  align_method = gr.Dropdown(label="Color Correction", choices=["wavelet", "adain", "no fix"], value="wavelet")
157
  with gr.Column():
158
- #result_image = gr.Image(label="Output", show_label=False, elem_id="result_image", source="canvas", width="100%", height="auto")
159
  result_image = gr.Image(label="Output", show_label=False, elem_id="result_image", width="100%", height="auto")
160
 
 
 
 
 
 
 
161
 
162
  inputs = [
163
  input_image,
 
139
  If S3Diff is helpful for you, please help star the GitHub Repo. Thanks!
140
  """
141
 
142
+ # Gradioアプリの作成
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():
150
  with gr.Column():
151
  input_image = gr.Image(type="pil")
152
+ run_button = gr.Button("Run")
153
 
154
  with gr.Accordion("Options", open=True):
155
  cfg_scale = gr.Slider(label="Classifier Free Guidance Scale (Set a value larger than 1 to enable it!)", minimum=1.0, maximum=1.1, value=1.07, step=0.01)
 
158
  latent_tiled_overlap = gr.Slider(label="Tile Overlap", minimum=16, maximum=48, value=32, step=1)
159
  align_method = gr.Dropdown(label="Color Correction", choices=["wavelet", "adain", "no fix"], value="wavelet")
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,