Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -104,7 +104,6 @@ def encode_image_to_base64(image):
|
|
| 104 |
def generate_image_from_text(encoded_image,pos_prompt=None):
|
| 105 |
neg_prompt = '''Detailed, complex textures, intricate patterns, realistic lighting, high contrast, reflections, fuzzy surface, realistic proportions, photographic quality, vibrant colors, detailed background, shadows, disfigured, deformed, ugly, multiple, duplicate.'''
|
| 106 |
encoded_str = encode_image_to_base64(encoded_image)
|
| 107 |
-
new_prompt = gen_pos_prompt(pos_prompt)
|
| 108 |
if pos_prompt:
|
| 109 |
parameters = {
|
| 110 |
'taskType': 'IMAGE_VARIATION',
|
|
@@ -199,8 +198,7 @@ with gr.Blocks() as demo:
|
|
| 199 |
image_mode="RGBA",
|
| 200 |
sources="upload",
|
| 201 |
type="pil",
|
| 202 |
-
elem_id="content_image"
|
| 203 |
-
visible=True
|
| 204 |
)
|
| 205 |
text_prompt = gr.Textbox(
|
| 206 |
label="Text Prompt",
|
|
@@ -241,24 +239,13 @@ with gr.Blocks() as demo:
|
|
| 241 |
interactive=False,
|
| 242 |
)
|
| 243 |
gr.Markdown("Note: The model shown here has a darker appearance. Download to get correct results.")
|
| 244 |
-
|
| 245 |
-
# gr.Examples(
|
| 246 |
-
# examples=[
|
| 247 |
-
# os.path.join("examples", img_name) for img_name in sorted(os.listdir("examples"))
|
| 248 |
-
# ],
|
| 249 |
-
# inputs=[input_image],
|
| 250 |
-
# outputs=[processed_image, output_model_obj, output_model_glb],
|
| 251 |
-
# cache_examples=True,
|
| 252 |
-
# fn=partial(run_example, do_remove_background=True, foreground_ratio=0.85, mc_resolution=256),
|
| 253 |
-
# label="Examples",
|
| 254 |
-
# examples_per_page=20
|
| 255 |
-
# )
|
| 256 |
submit.click(fn=check_input_image, inputs=[input_image]).success(
|
| 257 |
fn=run_example,
|
| 258 |
inputs=[input_image, do_remove_background, foreground_ratio, mc_resolution, text_prompt],
|
| 259 |
-
outputs=[output_model_obj, output_model_glb],
|
| 260 |
# outputs=[output_model_obj, output_model_glb],
|
| 261 |
)
|
| 262 |
|
| 263 |
demo.queue(max_size=10)
|
| 264 |
-
demo.launch(
|
|
|
|
| 104 |
def generate_image_from_text(encoded_image,pos_prompt=None):
|
| 105 |
neg_prompt = '''Detailed, complex textures, intricate patterns, realistic lighting, high contrast, reflections, fuzzy surface, realistic proportions, photographic quality, vibrant colors, detailed background, shadows, disfigured, deformed, ugly, multiple, duplicate.'''
|
| 106 |
encoded_str = encode_image_to_base64(encoded_image)
|
|
|
|
| 107 |
if pos_prompt:
|
| 108 |
parameters = {
|
| 109 |
'taskType': 'IMAGE_VARIATION',
|
|
|
|
| 198 |
image_mode="RGBA",
|
| 199 |
sources="upload",
|
| 200 |
type="pil",
|
| 201 |
+
elem_id="content_image"
|
|
|
|
| 202 |
)
|
| 203 |
text_prompt = gr.Textbox(
|
| 204 |
label="Text Prompt",
|
|
|
|
| 239 |
interactive=False,
|
| 240 |
)
|
| 241 |
gr.Markdown("Note: The model shown here has a darker appearance. Download to get correct results.")
|
| 242 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 243 |
submit.click(fn=check_input_image, inputs=[input_image]).success(
|
| 244 |
fn=run_example,
|
| 245 |
inputs=[input_image, do_remove_background, foreground_ratio, mc_resolution, text_prompt],
|
| 246 |
+
outputs=[processed_image, output_model_obj, output_model_glb],
|
| 247 |
# outputs=[output_model_obj, output_model_glb],
|
| 248 |
)
|
| 249 |
|
| 250 |
demo.queue(max_size=10)
|
| 251 |
+
demo.launch()
|