Update app.py
Browse files
app.py
CHANGED
@@ -31,7 +31,6 @@ def generate_image(prompt, negative_prompt=None, height=512, width=512, model="s
|
|
31 |
# Generate the image using Hugging Face's inference API with additional parameters
|
32 |
image = client.text_to_image(
|
33 |
prompt=prompt,
|
34 |
-
negative_prompt=negative_prompt,
|
35 |
height=height,
|
36 |
width=width,
|
37 |
model=model,
|
@@ -51,14 +50,13 @@ def generate_api():
|
|
51 |
|
52 |
# Extract required fields from the request
|
53 |
prompt = data.get('prompt', '')
|
54 |
-
negative_prompt = data.get('negative_prompt', None)
|
55 |
height = data.get('height', 1024) # Default height
|
56 |
width = data.get('width', 720) # Default width
|
57 |
num_inference_steps = data.get('num_inference_steps', 50) # Default number of inference steps
|
58 |
guidance_scale = data.get('guidance_scale', 7.5) # Default guidance scale
|
59 |
model_name = data.get('model', 'stabilityai/stable-diffusion-2-1') # Default model
|
60 |
seed = data.get('seed', None) # Seed for reproducibility, default is None
|
61 |
-
|
62 |
if not prompt:
|
63 |
return jsonify({"error": "Prompt is required"}), 400
|
64 |
|
|
|
31 |
# Generate the image using Hugging Face's inference API with additional parameters
|
32 |
image = client.text_to_image(
|
33 |
prompt=prompt,
|
|
|
34 |
height=height,
|
35 |
width=width,
|
36 |
model=model,
|
|
|
50 |
|
51 |
# Extract required fields from the request
|
52 |
prompt = data.get('prompt', '')
|
|
|
53 |
height = data.get('height', 1024) # Default height
|
54 |
width = data.get('width', 720) # Default width
|
55 |
num_inference_steps = data.get('num_inference_steps', 50) # Default number of inference steps
|
56 |
guidance_scale = data.get('guidance_scale', 7.5) # Default guidance scale
|
57 |
model_name = data.get('model', 'stabilityai/stable-diffusion-2-1') # Default model
|
58 |
seed = data.get('seed', None) # Seed for reproducibility, default is None
|
59 |
+
|
60 |
if not prompt:
|
61 |
return jsonify({"error": "Prompt is required"}), 400
|
62 |
|