Spaces:
Running
Running
imseldrith
commited on
Commit
·
ee669d4
1
Parent(s):
f424b43
Update app.py
Browse files
app.py
CHANGED
@@ -13,6 +13,7 @@ def generate_image():
|
|
13 |
prompt = request.form['prompt']
|
14 |
style = request.form['style']
|
15 |
ratio = request.form['ratio']
|
|
|
16 |
|
17 |
imagine = Imagine()
|
18 |
|
@@ -20,7 +21,11 @@ def generate_image():
|
|
20 |
img_data = imagine.sdprem(
|
21 |
prompt=prompt,
|
22 |
style=Style[style],
|
23 |
-
ratio=Ratio[ratio]
|
|
|
|
|
|
|
|
|
24 |
)
|
25 |
except Exception as e:
|
26 |
return f"An error occurred while generating the image: {e}"
|
@@ -47,6 +52,7 @@ def api_generate_image():
|
|
47 |
prompt = data['prompt']
|
48 |
style = data['style']
|
49 |
ratio = data['ratio']
|
|
|
50 |
|
51 |
imagine = Imagine()
|
52 |
|
@@ -54,7 +60,11 @@ def api_generate_image():
|
|
54 |
img_data = imagine.sdprem(
|
55 |
prompt=prompt,
|
56 |
style=Style[style],
|
57 |
-
ratio=Ratio[ratio]
|
|
|
|
|
|
|
|
|
58 |
)
|
59 |
except Exception as e:
|
60 |
return jsonify({'error': f"An error occurred while generating the image: {e}"}), 500
|
@@ -78,4 +88,4 @@ def api_generate_image():
|
|
78 |
|
79 |
if __name__ == "__main__":
|
80 |
app.run(host="0.0.0.0", port=7860)
|
81 |
-
|
|
|
13 |
prompt = request.form['prompt']
|
14 |
style = request.form['style']
|
15 |
ratio = request.form['ratio']
|
16 |
+
model = request.form['model']
|
17 |
|
18 |
imagine = Imagine()
|
19 |
|
|
|
21 |
img_data = imagine.sdprem(
|
22 |
prompt=prompt,
|
23 |
style=Style[style],
|
24 |
+
ratio=Ratio[ratio],
|
25 |
+
seed=1000,
|
26 |
+
cfg=16,
|
27 |
+
model=Model[model],
|
28 |
+
asbase64=False
|
29 |
)
|
30 |
except Exception as e:
|
31 |
return f"An error occurred while generating the image: {e}"
|
|
|
52 |
prompt = data['prompt']
|
53 |
style = data['style']
|
54 |
ratio = data['ratio']
|
55 |
+
model = data['model']
|
56 |
|
57 |
imagine = Imagine()
|
58 |
|
|
|
60 |
img_data = imagine.sdprem(
|
61 |
prompt=prompt,
|
62 |
style=Style[style],
|
63 |
+
ratio=Ratio[ratio],
|
64 |
+
seed=1000,
|
65 |
+
cfg=16,
|
66 |
+
model=Model[model],
|
67 |
+
asbase64=False
|
68 |
)
|
69 |
except Exception as e:
|
70 |
return jsonify({'error': f"An error occurred while generating the image: {e}"}), 500
|
|
|
88 |
|
89 |
if __name__ == "__main__":
|
90 |
app.run(host="0.0.0.0", port=7860)
|
91 |
+
|