ngoctuanai commited on
Commit
2845f78
·
1 Parent(s): e3c6c27

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +40 -21
app.py CHANGED
@@ -87,48 +87,67 @@ css = """
87
  }
88
 
89
  /* Button Styles */
90
- .gr-button-primary {
91
  color: #fff;
92
  background-color: #2563eb;
93
  border-color: #1d4ed8;
 
 
 
 
 
 
 
94
  }
95
 
96
- .gr-button-primary:hover {
97
  background-color: #1d4ed8;
98
  border-color: #1d4ed8;
99
  }
100
 
101
- /* Input Styles */
102
- .gr-textbox {
103
  border-color: #a0aec0;
104
- padding: 9px 12px;
 
 
 
 
105
  }
106
 
107
- .gr-textbox:focus {
108
  border-color: #2563eb;
109
  box-shadow: 0 0 0 2px rgba(37,99,235,.25);
110
  }
111
 
112
  /* Output Image Styles */
113
- #gallery img {
114
  max-width: 100%;
115
  height: auto;
116
  border-radius: 6px;
117
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
118
  }
119
-
120
- /* Advanced settings accordion styles */
121
- .gr-accordion-header {
122
- font-weight: 500;
123
- color: #4a5568;
124
- padding: 10px 16px;
125
- }
126
  """
127
 
128
- with gr.Interface(fn=generate_txt2img, inputs=[current_model, text_prompt, negative_prompt, image_style], outputs=image_output, css=css) as demo:
129
- favicon = '<img src="" width="48px" style="display: inline">'
130
- demo.set_input_properties("current_model", label="Current Model")
131
- demo.set_input_properties("text_prompt", label="Prompt", placeholder="Enter a prompt", lines=1)
132
- demo.set_input_properties("text_button", label="Generate", button=True, primary=True)
133
-
134
- demo.launch(share=True, host='0.0.0.0', port=int(os.environ.get('PORT', 8080)))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  }
88
 
89
  /* Button Styles */
90
+ .gradio-button {
91
  color: #fff;
92
  background-color: #2563eb;
93
  border-color: #1d4ed8;
94
+ cursor: pointer;
95
+ padding: 0.375rem 0.75rem;
96
+ font-size: 0.875rem;
97
+ line-height: 1.5;
98
+ border-radius: 0.25rem;
99
+ transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out,
100
+ box-shadow 0.15s ease-in-out;
101
  }
102
 
103
+ .gradio-button:hover {
104
  background-color: #1d4ed8;
105
  border-color: #1d4ed8;
106
  }
107
 
108
+ .gradio-input {
 
109
  border-color: #a0aec0;
110
+ padding: 0.375rem 0.75rem;
111
+ font-size: 0.875rem;
112
+ line-height: 1.5;
113
+ border-radius: 0.25rem;
114
+ transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
115
  }
116
 
117
+ .gradio-input:focus {
118
  border-color: #2563eb;
119
  box-shadow: 0 0 0 2px rgba(37,99,235,.25);
120
  }
121
 
122
  /* Output Image Styles */
123
+ .gradio-output img {
124
  max-width: 100%;
125
  height: auto;
126
  border-radius: 6px;
127
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
128
  }
 
 
 
 
 
 
 
129
  """
130
 
131
+ def generate_txt2img(current_model, text_prompt, negative_prompt, image_style):
132
+ # Your generation code here
133
+ pass
134
+
135
+ favicon = '<img src="" width="48px" style="display: inline">'
136
+ current_model = gr.inputs.Dropdown(label="Current Model", choices=list_models, default=list_models[1])
137
+ text_prompt = gr.inputs.Textbox(label="Prompt", placeholder="Enter a prompt", lines=1)
138
+ negative_prompt = gr.inputs.Textbox(label="Negative Prompt", value="text, blurry, fuzziness", lines=1)
139
+ image_style = gr.inputs.Dropdown(label="Style", choices=["None style", "Cinematic", "Digital Art", "Portrait"], default="None style")
140
+ text_button = gr.outputs.Button(label="Generate", type="button")
141
+
142
+ image_output = gr.outputs.Image(label="Generated Image")
143
+
144
+ interface = gr.Interface(
145
+ fn=generate_txt2img,
146
+ inputs=[current_model, text_prompt, negative_prompt, image_style],
147
+ outputs=image_output,
148
+ layout="vertical",
149
+ css=css,
150
+ title=favicon + " AI Diffusion"
151
+ )
152
+
153
+ interface.launch()