ruslanmv commited on
Commit
765540e
1 Parent(s): 356a5f4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -74
app.py CHANGED
@@ -92,84 +92,18 @@ def generate_txt2img(current_model, prompt, is_negative=False, image_style="None
92
  image = Image.open(io.BytesIO(image_bytes))
93
  return image
94
 
95
- css = """
96
- /* General Container Styles */
97
- .gradio-container {
98
- font-family: 'IBM Plex Sans', sans-serif;
99
- max-width: 730px !important;
100
- margin: auto;
101
- padding-top: 1.5rem;
102
- text-align: center; /* Center the content horizontally */
103
- }
104
- /* Button Styles */
105
- .gr-button {
106
- color: white;
107
- background: #007bff; /* Use a primary color for the background */
108
- white-space: nowrap;
109
- border: none;
110
- padding: 10px 20px;
111
- border-radius: 8px;
112
- cursor: pointer;
113
- transition: background-color 0.3s, color 0.3s;
114
- }
115
- .gr-button:hover {
116
- background-color: #0056b3; /* Darken the background color on hover */
117
- }
118
- /* Share Button Styles */
119
- #share-btn-container {
120
- padding: 0.5rem !important;
121
- background-color: #007bff; /* Use a primary color for the background */
122
- justify-content: center;
123
- align-items: center;
124
- border-radius: 9999px !important;
125
- max-width: 13rem;
126
- margin: 0 auto; /* Center the container horizontally */
127
- transition: background-color 0.3s;
128
- }
129
- #share-btn-container:hover {
130
- background-color: #0056b3; /* Darken the background color on hover */
131
- }
132
- #share-btn {
133
- all: initial;
134
- color: #ffffff;
135
- font-weight: 600;
136
- cursor: pointer;
137
- font-family: 'IBM Plex Sans', sans-serif;
138
- margin: 0.5rem !important;
139
- padding: 0.5rem !important;
140
- }
141
- /* Other Styles */
142
- #gallery {
143
- min-height: 22rem;
144
- margin: auto; /* Center the gallery horizontally */
145
- border-bottom-right-radius: 0.5rem !important;
146
- border-bottom-left-radius: 0.5rem !important;
147
- }
148
- /* Centered Container for the Image */
149
- .image-container {
150
- max-width: 100%; /* Set the maximum width for the container */
151
- margin: auto; /* Center the container horizontally */
152
- padding: 20px; /* Add padding for spacing */
153
- border: 1px solid #ccc; /* Add a subtle border to the container */
154
- border-radius: 10px;
155
- overflow: hidden; /* Hide overflow if the image is larger */
156
- max-height: 22rem; /* Set a maximum height for the container */
157
- }
158
- /* Set a fixed size for the image */
159
- .image-container img {
160
- max-width: 100%; /* Ensure the image fills the container */
161
- height: auto; /* Maintain aspect ratio */
162
- max-height: 100%; /* Set a maximum height for the image */
163
- border-radius: 10px;
164
- box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.2);
165
- }
166
- """
167
 
 
 
168
 
169
  PTI_SD_DESCRIPTION = '''
170
  <div id="content_align">
171
  <span style="color:darkred;font-size:32px;font-weight:bold">
172
- MultiMulti Stable Diffusion Image Generation Simplified Version
173
  </span>
174
  </div>
175
  <div id="content_align">
@@ -188,7 +122,7 @@ with gr.Blocks(css=css) as demo:
188
  with gr.Row():
189
  with gr.Column():
190
  current_model = gr.Dropdown(label="Select Model", choices=list_models, value=list_models[1])
191
- text_prompt = gr.Textbox(label="Input Prompt", placeholder="Example: a cute dog", lines=2)
192
 
193
  with gr.Column():
194
  negative_prompt = gr.Textbox(label="Negative Prompt (optional)", placeholder="Example: blurry, unfocused", lines=2)
 
92
  image = Image.open(io.BytesIO(image_bytes))
93
  return image
94
 
95
+ # Function to read CSS from file
96
+ def read_css_from_file(filename):
97
+ with open(filename, "r") as file:
98
+ return file.read()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99
 
100
+ # Read CSS from file
101
+ css = read_css_from_file("style.css")
102
 
103
  PTI_SD_DESCRIPTION = '''
104
  <div id="content_align">
105
  <span style="color:darkred;font-size:32px;font-weight:bold">
106
+ Stable Diffusion Models Image Generation
107
  </span>
108
  </div>
109
  <div id="content_align">
 
122
  with gr.Row():
123
  with gr.Column():
124
  current_model = gr.Dropdown(label="Select Model", choices=list_models, value=list_models[1])
125
+ text_prompt = gr.Textbox(label="Input Prompt", placeholder="Example: woman in the street ", lines=2)
126
 
127
  with gr.Column():
128
  negative_prompt = gr.Textbox(label="Negative Prompt (optional)", placeholder="Example: blurry, unfocused", lines=2)