Spaces:
Runtime error
Runtime error
Update backup.app.py
Browse files- backup.app.py +12 -4
backup.app.py
CHANGED
|
@@ -27,11 +27,19 @@ def set_model(current_model):
|
|
| 27 |
current_model = models[current_model]
|
| 28 |
return gr.update(label=(f"{current_model}"))
|
| 29 |
|
| 30 |
-
|
| 31 |
def send_it1(inputs, model_choice):
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
css=""""""
|
| 36 |
|
| 37 |
|
|
|
|
| 27 |
current_model = models[current_model]
|
| 28 |
return gr.update(label=(f"{current_model}"))
|
| 29 |
|
|
|
|
| 30 |
def send_it1(inputs, model_choice):
|
| 31 |
+
proc1 = models2[model_choice]
|
| 32 |
+
output1 = proc1(inputs)
|
| 33 |
+
if not os.path.exists('saved_prompts'):
|
| 34 |
+
os.makedirs('saved_prompts')
|
| 35 |
+
if not os.path.exists('saved_images'):
|
| 36 |
+
os.makedirs('saved_images')
|
| 37 |
+
safe_filename = slugify(inputs)[:50] # Truncate to first 50 characters
|
| 38 |
+
with open(f'saved_prompts/{safe_filename}.txt', 'w') as f:
|
| 39 |
+
f.write(inputs)
|
| 40 |
+
output1.save(f'saved_images/{safe_filename}.png')
|
| 41 |
+
return output1
|
| 42 |
+
|
| 43 |
css=""""""
|
| 44 |
|
| 45 |
|