Spaces:
Running
on
Zero
Running
on
Zero
fallenshock
commited on
Commit
·
e3199ed
1
Parent(s):
0cb86de
update tok
Browse files
app.py
CHANGED
|
@@ -79,19 +79,19 @@ def FlowEditRun(
|
|
| 79 |
|
| 80 |
):
|
| 81 |
|
| 82 |
-
if oauth_token is None:
|
| 83 |
-
|
| 84 |
-
if model_type == 'SD3':
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
# elif model_type == 'FLUX':
|
| 96 |
# try:
|
| 97 |
# huggingface_hub.get_hf_file_metadata(huggingface_hub.hf_hub_url(FLUXSTRING, 'flux1-dev.safetensors'),
|
|
@@ -119,10 +119,10 @@ def FlowEditRun(
|
|
| 119 |
|
| 120 |
if model_type == 'FLUX':
|
| 121 |
# pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-schnell", torch_dtype=torch.float16)
|
| 122 |
-
pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", torch_dtype=torch.float16
|
| 123 |
loaded_model = 'FLUX'
|
| 124 |
elif model_type == 'SD3':
|
| 125 |
-
pipe = StableDiffusion3Pipeline.from_pretrained("stabilityai/stable-diffusion-3-medium-diffusers", torch_dtype=torch.float16
|
| 126 |
loaded_model = 'SD3'
|
| 127 |
else:
|
| 128 |
raise NotImplementedError(f"Model type {model_type} not implemented")
|
|
@@ -239,8 +239,8 @@ with gr.Blocks() as demo:
|
|
| 239 |
|
| 240 |
gr.HTML(intro)
|
| 241 |
|
| 242 |
-
with gr.Row():
|
| 243 |
-
|
| 244 |
|
| 245 |
with gr.Row(equal_height=True):
|
| 246 |
image_src = gr.Image(type="filepath", label="Source Image", value="inputs/cat.png",)
|
|
|
|
| 79 |
|
| 80 |
):
|
| 81 |
|
| 82 |
+
# if oauth_token is None:
|
| 83 |
+
# raise gr.Error("You must be logged in to use Stable Diffusion 3.0 and FLUX.1 models.")
|
| 84 |
+
# if model_type == 'SD3':
|
| 85 |
+
# try:
|
| 86 |
+
# print(f'token: {oauth_token.token}')
|
| 87 |
+
# huggingface_hub.get_hf_file_metadata(huggingface_hub.hf_hub_url(SD3STRING, 'transformer/diffusion_pytorch_model.safetensors'),
|
| 88 |
+
# token=oauth_token.token)
|
| 89 |
+
# print('Has Access')
|
| 90 |
+
# # except huggingface_hub.utils._errors.GatedRepoError:
|
| 91 |
+
# except huggingface_hub.errors.GatedRepoError:
|
| 92 |
+
# raise gr.Error("You need to accept the license agreement to use Stable Diffusion 3. "
|
| 93 |
+
# "Visit the <a href='https://huggingface.co/stabilityai/stable-diffusion-3-medium-diffusers'>"
|
| 94 |
+
# "model page</a> to get access.")
|
| 95 |
# elif model_type == 'FLUX':
|
| 96 |
# try:
|
| 97 |
# huggingface_hub.get_hf_file_metadata(huggingface_hub.hf_hub_url(FLUXSTRING, 'flux1-dev.safetensors'),
|
|
|
|
| 119 |
|
| 120 |
if model_type == 'FLUX':
|
| 121 |
# pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-schnell", torch_dtype=torch.float16)
|
| 122 |
+
pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", torch_dtype=torch.float16, token=os.getenv('HF_ACCESS_TOK'))
|
| 123 |
loaded_model = 'FLUX'
|
| 124 |
elif model_type == 'SD3':
|
| 125 |
+
pipe = StableDiffusion3Pipeline.from_pretrained("stabilityai/stable-diffusion-3-medium-diffusers", torch_dtype=torch.float16, token=os.getenv('HF_ACCESS_TOK'))
|
| 126 |
loaded_model = 'SD3'
|
| 127 |
else:
|
| 128 |
raise NotImplementedError(f"Model type {model_type} not implemented")
|
|
|
|
| 239 |
|
| 240 |
gr.HTML(intro)
|
| 241 |
|
| 242 |
+
# with gr.Row():
|
| 243 |
+
# gr.LoginButton(value="Login to HF (For SD3 and FLUX access)", variant="primary")
|
| 244 |
|
| 245 |
with gr.Row(equal_height=True):
|
| 246 |
image_src = gr.Image(type="filepath", label="Source Image", value="inputs/cat.png",)
|