File tree Expand file tree Collapse file tree 2 files changed +35
-1
lines changed Expand file tree Collapse file tree 2 files changed +35
-1
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ async function promptDallE(input) {
11
11
document . getElementById ( "input" ) . disabled = true ;
12
12
13
13
const model = document . getElementById ( "image-model" ) . value ;
14
+ const size = document . getElementById ( "image-size" ) . value ;
14
15
const response = await fetch ( "v1/images/generations" , {
15
16
method : "POST" ,
16
17
headers : {
@@ -21,7 +22,7 @@ async function promptDallE(input) {
21
22
steps : 10 ,
22
23
prompt : input ,
23
24
n : 1 ,
24
- size : "512x512" ,
25
+ size : size ,
25
26
} ) ,
26
27
} ) ;
27
28
const json = await response . json ( ) ;
@@ -48,4 +49,13 @@ async function promptDallE(input) {
48
49
49
50
document . getElementById ( "input" ) . focus ( ) ;
50
51
document . getElementById ( "genimage" ) . addEventListener ( "submit" , genImage ) ;
52
+
53
+ // Handle Enter key press in the prompt input
54
+ document . getElementById ( "input" ) . addEventListener ( "keypress" , function ( event ) {
55
+ if ( event . key === "Enter" ) {
56
+ event . preventDefault ( ) ;
57
+ genImage ( event ) ;
58
+ }
59
+ } ) ;
60
+
51
61
document . getElementById ( "loader" ) . style . display = "none" ;
Original file line number Diff line number Diff line change @@ -91,6 +91,30 @@ <h2 class="text-2xl font-bold text-white mb-6">Generate an Image</h2>
91
91
</ svg >
92
92
</ span >
93
93
</ div >
94
+
95
+ <!-- Size Selection -->
96
+ < div class ="mt-4 ">
97
+ < label for ="image-size " class ="block text-sm font-medium text-gray-300 mb-2 ">
98
+ < i class ="fas fa-expand-arrows-alt mr-2 "> </ i > Image Size:
99
+ </ label >
100
+ < input
101
+ type ="text "
102
+ id ="image-size "
103
+ value ="256x256 "
104
+ placeholder ="e.g., 256x256, 512x512, 1024x1024 "
105
+ class ="bg-gray-900 text-white border border-gray-700 focus:border-blue-500 focus:ring focus:ring-blue-500 focus:ring-opacity-50 rounded-lg shadow-sm p-2.5 w-full max-w-xs transition-colors duration-200 "
106
+ />
107
+ </ div >
108
+
109
+ <!-- Submit Button -->
110
+ < div class ="mt-6 ">
111
+ < button
112
+ type ="submit "
113
+ class ="w-full bg-gradient-to-r from-blue-600 to-indigo-600 hover:from-blue-700 hover:to-indigo-700 text-white font-semibold py-3 px-6 rounded-lg transition duration-300 ease-in-out transform hover:scale-105 hover:shadow-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-opacity-50 "
114
+ >
115
+ < i class ="fas fa-magic mr-2 "> </ i > Generate Image
116
+ </ button >
117
+ </ div >
94
118
</ form >
95
119
96
120
<!-- Image Results Container -->
You can’t perform that action at this time.
0 commit comments