Update app.py
Browse files
app.py
CHANGED
|
@@ -9,7 +9,7 @@ import argparse
|
|
| 9 |
from einops import rearrange
|
| 10 |
from fire import Fire
|
| 11 |
from PIL import ExifTags, Image
|
| 12 |
-
import spaces
|
| 13 |
|
| 14 |
import torch
|
| 15 |
import torch.nn.functional as F
|
|
@@ -20,7 +20,7 @@ from transformers import pipeline
|
|
| 20 |
from flux.sampling import denoise, get_schedule, prepare, unpack
|
| 21 |
from flux.util import (configs, embed_watermark, load_ae, load_clip, load_flow_model, load_t5)
|
| 22 |
from huggingface_hub import login
|
| 23 |
-
login(token=os.getenv('Token'))
|
| 24 |
|
| 25 |
import torch
|
| 26 |
|
|
@@ -61,7 +61,7 @@ is_schnell = False
|
|
| 61 |
output_dir = 'result'
|
| 62 |
add_sampling_metadata = True
|
| 63 |
|
| 64 |
-
|
| 65 |
@torch.inference_mode()
|
| 66 |
def edit(init_image, source_prompt, target_prompt, editing_strategy, num_steps, inject_step, guidance, seed):
|
| 67 |
global ae, t5, clip, model, name, is_schnell, output_dir, add_sampling_metadata
|
|
@@ -269,4 +269,4 @@ def create_demo(model_name: str, device: str = "cuda:0" if torch.cuda.is_availab
|
|
| 269 |
return demo
|
| 270 |
|
| 271 |
demo = create_demo("flux-dev", "cuda")
|
| 272 |
-
demo.launch()
|
|
|
|
| 9 |
from einops import rearrange
|
| 10 |
from fire import Fire
|
| 11 |
from PIL import ExifTags, Image
|
| 12 |
+
#import spaces
|
| 13 |
|
| 14 |
import torch
|
| 15 |
import torch.nn.functional as F
|
|
|
|
| 20 |
from flux.sampling import denoise, get_schedule, prepare, unpack
|
| 21 |
from flux.util import (configs, embed_watermark, load_ae, load_clip, load_flow_model, load_t5)
|
| 22 |
from huggingface_hub import login
|
| 23 |
+
#login(token=os.getenv('Token'))
|
| 24 |
|
| 25 |
import torch
|
| 26 |
|
|
|
|
| 61 |
output_dir = 'result'
|
| 62 |
add_sampling_metadata = True
|
| 63 |
|
| 64 |
+
#@spaces.GPU(duration=120)
|
| 65 |
@torch.inference_mode()
|
| 66 |
def edit(init_image, source_prompt, target_prompt, editing_strategy, num_steps, inject_step, guidance, seed):
|
| 67 |
global ae, t5, clip, model, name, is_schnell, output_dir, add_sampling_metadata
|
|
|
|
| 269 |
return demo
|
| 270 |
|
| 271 |
demo = create_demo("flux-dev", "cuda")
|
| 272 |
+
demo.launch(share = True)
|