placed spaces.get and set for using the mode variable
Browse files
app.py
CHANGED
@@ -126,7 +126,8 @@ def bot_comms(message, history):
|
|
126 |
"""
|
127 |
Handles communication between Gradio and the models.
|
128 |
"""
|
129 |
-
global mode
|
|
|
130 |
logger.debug(f"bot_comms called with message: {message} and mode: {mode}")
|
131 |
|
132 |
if message == "check cuda":
|
@@ -136,13 +137,13 @@ def bot_comms(message, history):
|
|
136 |
|
137 |
if message == "imagery":
|
138 |
logger.debug("Switching to imagery mode.")
|
139 |
-
mode
|
140 |
yield "Imagery On! Type your prompt to make the image πΌοΈ"
|
141 |
return
|
142 |
|
143 |
if message == "chatting":
|
144 |
logger.debug("Switching to chatting mode.")
|
145 |
-
mode
|
146 |
yield "Imagery Off. Ask me any questions. βοΈ"
|
147 |
return
|
148 |
|
|
|
126 |
"""
|
127 |
Handles communication between Gradio and the models.
|
128 |
"""
|
129 |
+
# global mode
|
130 |
+
mode = spaces.get("mode", default="")
|
131 |
logger.debug(f"bot_comms called with message: {message} and mode: {mode}")
|
132 |
|
133 |
if message == "check cuda":
|
|
|
137 |
|
138 |
if message == "imagery":
|
139 |
logger.debug("Switching to imagery mode.")
|
140 |
+
spaces.set("mode", "imagery")
|
141 |
yield "Imagery On! Type your prompt to make the image πΌοΈ"
|
142 |
return
|
143 |
|
144 |
if message == "chatting":
|
145 |
logger.debug("Switching to chatting mode.")
|
146 |
+
spaces.set("mode", "chatting")
|
147 |
yield "Imagery Off. Ask me any questions. βοΈ"
|
148 |
return
|
149 |
|