Spaces:
Runtime error
Runtime error
rayochoajr
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,6 @@
|
|
|
|
|
|
|
|
1 |
import subprocess
|
2 |
import threading
|
3 |
import gradio as gr
|
@@ -168,7 +171,13 @@ def generate_image(text_prompt, seed, quality, server):
|
|
168 |
"""
|
169 |
|
170 |
prompt = json.loads(prompt_text)
|
171 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
ws = websocket.WebSocket()
|
173 |
ws.connect(f"ws://{server_address}/ws?clientId={client_id}")
|
174 |
images = get_images(ws, prompt, server_address)
|
@@ -197,7 +206,7 @@ with gr.Blocks() as demo:
|
|
197 |
text_prompt = gr.Textbox(label="Text Prompt", value="masterpiece best quality man")
|
198 |
seed = gr.Number(label="Seed", value=5)
|
199 |
quality = gr.Radio(label="Quality", choices=["Low", "Medium", "High"], value="Low")
|
200 |
-
server = gr.Radio(label="Server", choices=["AWS Server", "Home Server"], value="AWS Server")
|
201 |
generate_button = gr.Button("Generate Image")
|
202 |
cancel_button = gr.Button("Cancel Request")
|
203 |
|
@@ -208,3 +217,4 @@ with gr.Blocks() as demo:
|
|
208 |
cancel_button.click(fn=cancel_request, inputs=[], outputs=[])
|
209 |
|
210 |
demo.launch()
|
|
|
|
1 |
+
Here's the complete code with the additional option for the server:
|
2 |
+
|
3 |
+
```python
|
4 |
import subprocess
|
5 |
import threading
|
6 |
import gradio as gr
|
|
|
171 |
"""
|
172 |
|
173 |
prompt = json.loads(prompt_text)
|
174 |
+
if server == "AWS Server":
|
175 |
+
server_address = "3.14.144.23:8188"
|
176 |
+
elif server == "Home Server":
|
177 |
+
server_address = "192.168.50.136:8188"
|
178 |
+
else:
|
179 |
+
server_address = "73.206.199.71:18188"
|
180 |
+
|
181 |
ws = websocket.WebSocket()
|
182 |
ws.connect(f"ws://{server_address}/ws?clientId={client_id}")
|
183 |
images = get_images(ws, prompt, server_address)
|
|
|
206 |
text_prompt = gr.Textbox(label="Text Prompt", value="masterpiece best quality man")
|
207 |
seed = gr.Number(label="Seed", value=5)
|
208 |
quality = gr.Radio(label="Quality", choices=["Low", "Medium", "High"], value="Low")
|
209 |
+
server = gr.Radio(label="Server", choices=["AWS Server", "Home Server", "R - PC"], value="AWS Server")
|
210 |
generate_button = gr.Button("Generate Image")
|
211 |
cancel_button = gr.Button("Cancel Request")
|
212 |
|
|
|
217 |
cancel_button.click(fn=cancel_request, inputs=[], outputs=[])
|
218 |
|
219 |
demo.launch()
|
220 |
+
```
|