Spaces:
Running
Running
Alex
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -37,7 +37,7 @@ def send_text2image_request(prompt, ratio, style, uuid_value, token):
|
|
37 |
return f"Error: {response.status_code} - {response.text}"
|
38 |
|
39 |
# Function for Image-to-Image (Send POST request with an image and other parameters)
|
40 |
-
def send_image2image_request(image, ratio, style, uuid_value, token):
|
41 |
# Access the URL from Secrets (Private)
|
42 |
url = os.getenv('API_URL_IMAGE') # Secret variable for the URL
|
43 |
if not url:
|
@@ -62,6 +62,9 @@ def send_image2image_request(image, ratio, style, uuid_value, token):
|
|
62 |
"is_img2img": "1"
|
63 |
}
|
64 |
|
|
|
|
|
|
|
65 |
if style and style != "0":
|
66 |
data["style_id"] = style
|
67 |
|
@@ -302,10 +305,11 @@ def create_interface():
|
|
302 |
img_uuid = gr.Textbox(label="UUID ID") # Default UUID
|
303 |
img_token = gr.Textbox(label="Token ID") # Password type for token
|
304 |
img_output = gr.Textbox() # Output for image-to-image response
|
|
|
305 |
|
306 |
# Bind the image-to-image function to the interface
|
307 |
img_submit_button = gr.Button("Generate Image")
|
308 |
-
img_submit_button.click(send_image2image_request, inputs=[img_url, img_ratio, img_style, img_uuid, img_token], outputs=img_output)
|
309 |
|
310 |
with gr.Tab("Inpaint Image"):
|
311 |
# Inputs for Inpaint-to-Image
|
|
|
37 |
return f"Error: {response.status_code} - {response.text}"
|
38 |
|
39 |
# Function for Image-to-Image (Send POST request with an image and other parameters)
|
40 |
+
def send_image2image_request(image, ratio, style, uuid_value, token, prompt):
|
41 |
# Access the URL from Secrets (Private)
|
42 |
url = os.getenv('API_URL_IMAGE') # Secret variable for the URL
|
43 |
if not url:
|
|
|
62 |
"is_img2img": "1"
|
63 |
}
|
64 |
|
65 |
+
if prompt and prompt != "0":
|
66 |
+
data["prompt"] = prompt
|
67 |
+
|
68 |
if style and style != "0":
|
69 |
data["style_id"] = style
|
70 |
|
|
|
305 |
img_uuid = gr.Textbox(label="UUID ID") # Default UUID
|
306 |
img_token = gr.Textbox(label="Token ID") # Password type for token
|
307 |
img_output = gr.Textbox() # Output for image-to-image response
|
308 |
+
img_prompt = gr.Textbox() # Output for image-to-image response
|
309 |
|
310 |
# Bind the image-to-image function to the interface
|
311 |
img_submit_button = gr.Button("Generate Image")
|
312 |
+
img_submit_button.click(send_image2image_request, inputs=[img_url, img_ratio, img_style, img_uuid, img_token, img_prompt], outputs=img_output)
|
313 |
|
314 |
with gr.Tab("Inpaint Image"):
|
315 |
# Inputs for Inpaint-to-Image
|