xingpng commited on
Commit
55f13e6
1 Parent(s): db21656
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -184,7 +184,7 @@ def create_image(content_image_pil,
184
  content_image_pil = Image.fromarray(
185
  np.zeros((1024, 1024, 3), dtype=np.uint8)).convert('RGB')
186
 
187
- if prompt is None:
188
  blip_model = blip_model.to(device)
189
  inputs = blip_processor(content_image_pil, return_tensors="pt").to(device)
190
  out = blip_model.generate(**inputs)
@@ -318,9 +318,14 @@ with block:
318
  value="Image-Driven Style Transfer",
319
  label="task")
320
 
 
 
 
 
321
  prompt = gr.Textbox(label="Prompt",
322
  value="there is a small house with a sheep statue on top of it")
323
-
 
324
 
325
  scale_c = gr.Slider(minimum=0, maximum=2.0, step=0.01, value=0.6, label="Content Scale")
326
  scale_s = gr.Slider(minimum=0, maximum=2.0, step=0.01, value=1.0, label="Style Scale")
 
184
  content_image_pil = Image.fromarray(
185
  np.zeros((1024, 1024, 3), dtype=np.uint8)).convert('RGB')
186
 
187
+ if prompt is '':
188
  blip_model = blip_model.to(device)
189
  inputs = blip_processor(content_image_pil, return_tensors="pt").to(device)
190
  out = blip_model.generate(**inputs)
 
318
  value="Image-Driven Style Transfer",
319
  label="task")
320
 
321
+ prompt_type = gr.Radio(
322
+ ["caption of Blip", "user input"],
323
+ value="caption of Blip",
324
+ label="task")
325
  prompt = gr.Textbox(label="Prompt",
326
  value="there is a small house with a sheep statue on top of it")
327
+ if prompt_type == "caption of Blip":
328
+ prompt =''
329
 
330
  scale_c = gr.Slider(minimum=0, maximum=2.0, step=0.01, value=0.6, label="Content Scale")
331
  scale_s = gr.Slider(minimum=0, maximum=2.0, step=0.01, value=1.0, label="Style Scale")