fffiloni commited on
Commit
c365e68
1 Parent(s): e45a98d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -15
app.py CHANGED
@@ -45,22 +45,22 @@ def train(prompt, init_image, trn_text, trn_steps):
45
 
46
  return "Training is finished !"
47
 
48
- def generate(prompt, init_image):
49
- init_image = Image.open(init_image).convert("RGB")
50
- init_image = init_image.resize((256, 256))
51
 
52
 
53
- res = pipe.train(
54
- prompt,
55
- init_image,
56
- guidance_scale=7.5,
57
- num_inference_steps=50,
58
- generator=generator,
59
- text_embedding_optimization_steps=0,
60
- model_fine_tuning_optimization_steps=0)
61
 
62
- with torch.no_grad():
63
- torch.cuda.empty_cache()
64
 
65
 
66
 
@@ -141,8 +141,8 @@ with gr.Blocks(css=css) as block:
141
  prompt_input = gr.Textbox(label="Target text", placeholder="Describe the image with what you want to change about the subject")
142
  image_init = gr.Image(source="upload", type="filepath",label="Input Image")
143
  with gr.Row():
144
- trn_text = gr.Slider(100, 500, value=250, label="text embedding")
145
- trn_steps = gr.Slider(250, 1000, value=500, label="finetuning steps")
146
  with gr.Row():
147
  train_btn = gr.Button("1.Train")
148
  gen_btn = gr.Button("2.Generate")
 
45
 
46
  return "Training is finished !"
47
 
48
+ def generate(prompt, init_image, trn_text, trn_steps):
49
+ #init_image = Image.open(init_image).convert("RGB")
50
+ #init_image = init_image.resize((256, 256))
51
 
52
 
53
+ #res = pipe.train(
54
+ # prompt,
55
+ # init_image,
56
+ # guidance_scale=7.5,
57
+ # num_inference_steps=50,
58
+ # generator=generator,
59
+ # text_embedding_optimization_steps=trn_text,
60
+ # model_fine_tuning_optimization_steps=trn_steps)
61
 
62
+ #with torch.no_grad():
63
+ # torch.cuda.empty_cache()
64
 
65
 
66
 
 
141
  prompt_input = gr.Textbox(label="Target text", placeholder="Describe the image with what you want to change about the subject")
142
  image_init = gr.Image(source="upload", type="filepath",label="Input Image")
143
  with gr.Row():
144
+ trn_text = gr.Slider(0, 500, step=50, value=250, label="text embedding")
145
+ trn_steps = gr.Slider(0, 1000, step=50, value=500, label="finetuning steps")
146
  with gr.Row():
147
  train_btn = gr.Button("1.Train")
148
  gen_btn = gr.Button("2.Generate")