ngoctuanai commited on
Commit
e3c6c27
·
1 Parent(s): 2b696cd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -43
app.py CHANGED
@@ -123,50 +123,12 @@ css = """
123
  color: #4a5568;
124
  padding: 10px 16px;
125
  }
126
-
127
- .gr-accordion-panel {
128
- padding: 0;
129
- }
130
-
131
- /* Footer Styles */
132
- .footer {
133
- display: flex;
134
- justify-content: center;
135
- align-items: center;
136
- margin-top: 3rem;
137
- color: #4a5568;
138
- }
139
-
140
- .footer p {
141
- margin-bottom: 0;
142
- font-size: 0.875rem;
143
- }
144
-
145
  """
146
 
147
- with gr.Blocks(css=css) as demo:
148
  favicon = '<img src="" width="48px" style="display: inline">'
149
- gr.Markdown(
150
- f"""<h1><center>{favicon} AI Diffusion</center></h1>
151
- """
152
- )
153
-
154
- with gr.Row(elem_id="prompt-container"):
155
- current_model = gr.Dropdown(label="Current Model", choices=list_models, value=list_models[1])
156
-
157
- with gr.Row(elem_id="prompt-container"):
158
- text_prompt = gr.Textbox(label="Prompt", placeholder="Enter a prompt", lines=1, elem_id="prompt-text-input")
159
- text_button = gr.Button("Generate", variant='primary', elem_id="gen-button")
160
-
161
- with gr.Row():
162
- image_output = gr.Image(type="pil", label="Generated Image", elem_id="gallery")
163
-
164
- with gr.Accordion("Advanced Settings", open=False):
165
- negative_prompt = gr.Textbox(label="Negative Prompt", value="text, blurry, fuzziness", lines=1, elem_id="negative-prompt-text-input")
166
- image_style = gr.Dropdown(label="Style", choices=["None style", "Cinematic", "Digital Art", "Portrait"], value="None style", allow_custom_value=False)
167
-
168
- text_button.click(generate_txt2img, inputs=[current_model, text_prompt, negative_prompt, image_style], outputs=image_output)
169
-
170
- gr.Footer("Powered by ngoctuanai", outbound_link="https://ngoctuanai-aidiffusion.hf.space")
171
 
172
- demo.launch()
 
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)))