ruslanmv commited on
Commit
3de03d4
·
verified ·
1 Parent(s): 5e7319a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +52 -1
app.py CHANGED
@@ -137,6 +137,56 @@ def gradio_load_model(selected_model):
137
  return "No model selected. Please select a model to load."
138
  return load_model(selected_model)
139
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
140
  with gr.Blocks(
141
  css="""
142
  .container {
@@ -176,4 +226,5 @@ with gr.Blocks(
176
  **Credits**: Created by Ruslan Magana Vsevolodovna. For more information, visit [https://ruslanmv.com/](https://ruslanmv.com/).""")
177
 
178
  if __name__ == "__main__":
179
- interface.launch(debug=True)
 
 
137
  return "No model selected. Please select a model to load."
138
  return load_model(selected_model)
139
 
140
+
141
+
142
+ with gr.Blocks(
143
+ css="""
144
+ .container {
145
+ max-width: 800px;
146
+ margin: auto;
147
+ padding: 20px;
148
+ background-color: #f8f8f8;
149
+ border-radius: 10px;
150
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
151
+ }
152
+ """
153
+ ) as interface:
154
+ with gr.Tab("Image Generator"):
155
+ with gr.Column():
156
+ gr.Markdown("# Text-to-Image Generator")
157
+ model_dropdown = gr.Dropdown(choices=list(models.keys()), label="Select Model")
158
+ prompt_textbox = gr.Textbox(label="Enter Text Prompt")
159
+ seed_slider = gr.Slider(minimum=-1, maximum=1000, step=1, value=-1, label="Random Seed (-1 for random)")
160
+ generate_button = gr.Button("Generate Image")
161
+ output_image = gr.Image(label="Generated Image")
162
+ runtime_info_textbox = gr.Textbox(label="Runtime Information", lines=2, interactive=False)
163
+
164
+ # Add example prompts at the bottom
165
+ gr.Markdown("### Example Prompts")
166
+ examples = gr.Examples(
167
+ examples=[
168
+ [list(models.keys())[0], "Sexy girl"],
169
+ [list(models.keys())[0], "Beautiful Woman"],
170
+ [list(models.keys())[0], "Future City"]
171
+ ],
172
+ inputs=[model_dropdown, prompt_textbox],
173
+ )
174
+
175
+ generate_button.click(gradio_generate, inputs=[model_dropdown, prompt_textbox, seed_slider], outputs=[output_image, runtime_info_textbox])
176
+
177
+ with gr.Tab("Model Information"):
178
+ for model_key, model_info in models.items():
179
+ gr.Markdown(f"## {model_key}")
180
+ gr.Markdown(model_info["description"])
181
+
182
+ gr.Markdown("""---
183
+ **Credits**: Created by Ruslan Magana Vsevolodovna. For more information, visit [https://ruslanmv.com/](https://ruslanmv.com/).""")
184
+
185
+ if __name__ == "__main__":
186
+ interface.launch(debug=True)
187
+
188
+
189
+ '''
190
  with gr.Blocks(
191
  css="""
192
  .container {
 
226
  **Credits**: Created by Ruslan Magana Vsevolodovna. For more information, visit [https://ruslanmv.com/](https://ruslanmv.com/).""")
227
 
228
  if __name__ == "__main__":
229
+ interface.launch(debug=True)
230
+ '''