Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -45,7 +45,7 @@ if (!window.hasBeenRun) {
|
|
45 |
# f.write(SCRIPT)
|
46 |
|
47 |
# -------------------------------------------- For Memory - you will need to set up a dataset and HF_TOKEN ---------
|
48 |
-
UseMemory=
|
49 |
|
50 |
|
51 |
DATASET_REPO_URL="https://huggingface.co/datasets/awacke1/ChatbotMemory.csv"
|
@@ -169,69 +169,6 @@ def gan():
|
|
169 |
return images
|
170 |
|
171 |
|
172 |
-
def gan2():
|
173 |
-
r=store_message()
|
174 |
-
iface = gr.Interface(
|
175 |
-
store_message,
|
176 |
-
[
|
177 |
-
inputs.Textbox(placeholder="Your name"),
|
178 |
-
inputs.Textbox(placeholder="Your message", lines=2),
|
179 |
-
],
|
180 |
-
"html",
|
181 |
-
css="""
|
182 |
-
.message {background-color:cornflowerblue;color:white; padding:4px;margin:4px;border-radius:4px; }
|
183 |
-
""",
|
184 |
-
title="Reading/writing to a HuggingFace dataset repo from Spaces",
|
185 |
-
description=f"This is a demo of how to do simple *shared data persistence* in a Gradio Space, backed by a dataset repo.",
|
186 |
-
article=f"The dataset repo is [{DATASET_REPO_URL}]({DATASET_REPO_URL}) (open in new tab)",)
|
187 |
-
|
188 |
-
|
189 |
-
images = [
|
190 |
-
(random.choice(
|
191 |
-
[
|
192 |
-
"Comectress.png",
|
193 |
-
"Comic Plate 1 - Amnesia.png",
|
194 |
-
"Comic Plate 1 - Depths.png",
|
195 |
-
"Comic Plate 1 - Helion.png",
|
196 |
-
"Comic Plate 1 - Kitsune.png",
|
197 |
-
"Comic Plate 1 - Sinbad.png",
|
198 |
-
"Comic Plate 1 - Vampiress.png",
|
199 |
-
"Comic Plate 2 - Amnesia.png",
|
200 |
-
"Comic Plate 2 - Depths.png",
|
201 |
-
"Comic Plate 2 - Helion.png",
|
202 |
-
"Comic Plate 2 - Kitsune.png",
|
203 |
-
"Comic Plate 2 - Sinbad.png",
|
204 |
-
"Comic Plate 2 - Vampiress.png",
|
205 |
-
"Comic Plate 3 - Amnesia.png",
|
206 |
-
"Comic Plate 3 - Depths.png",
|
207 |
-
"Comic Plate 3 - Helion.png",
|
208 |
-
"Comic Plate 3 - Kitsune.png",
|
209 |
-
"Comic Plate 3 - Vampiress.png",
|
210 |
-
"Comic Plate 4 - Amnesia.png",
|
211 |
-
"Comic Plate 4 - Depths.png",
|
212 |
-
"Comic Plate 4 - Helion.png",
|
213 |
-
"Comic Plate 4 - Kitsune.png",
|
214 |
-
"Comic Plate 4 - Sinbad.png",
|
215 |
-
"Comic Plate 4 - Vampiress.png",
|
216 |
-
"Comic Plate 5 - Vampiress.png",
|
217 |
-
"Gold Suit.png",
|
218 |
-
"Heavens.png",
|
219 |
-
"Red Dot Sight.png",
|
220 |
-
"Starfire.png",
|
221 |
-
"Vamp 1.png",
|
222 |
-
"Vamp 2.png",
|
223 |
-
"Vamp 3.png",
|
224 |
-
"Vamp 4.png",
|
225 |
-
"Whirlwind.png",
|
226 |
-
"Zyphoria.png",
|
227 |
-
]
|
228 |
-
), f"label {i}" if i != 0 else "label" * 50)
|
229 |
-
for i in range(10)
|
230 |
-
]
|
231 |
-
iface.launch()
|
232 |
-
|
233 |
-
return images
|
234 |
-
|
235 |
with gr.Blocks() as demo:
|
236 |
with gr.Column(variant="panel"):
|
237 |
[
|
@@ -258,7 +195,6 @@ with gr.Blocks() as demo:
|
|
258 |
).style(grid=[2], height="auto")
|
259 |
|
260 |
btn.click(gan, None, gallery)
|
261 |
-
btn2.click(gan2, None, gallery2)
|
262 |
|
263 |
if __name__ == "__main__":
|
264 |
demo.launch()
|
|
|
45 |
# f.write(SCRIPT)
|
46 |
|
47 |
# -------------------------------------------- For Memory - you will need to set up a dataset and HF_TOKEN ---------
|
48 |
+
UseMemory=False
|
49 |
|
50 |
|
51 |
DATASET_REPO_URL="https://huggingface.co/datasets/awacke1/ChatbotMemory.csv"
|
|
|
169 |
return images
|
170 |
|
171 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
with gr.Blocks() as demo:
|
173 |
with gr.Column(variant="panel"):
|
174 |
[
|
|
|
195 |
).style(grid=[2], height="auto")
|
196 |
|
197 |
btn.click(gan, None, gallery)
|
|
|
198 |
|
199 |
if __name__ == "__main__":
|
200 |
demo.launch()
|