Spaces:
Runtime error
Runtime error
Anonymous Authors
commited on
Commit
•
410bb7d
1
Parent(s):
cabb75a
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import gradio as gr
|
2 |
from datasets import load_from_disk
|
3 |
import numpy as np
|
|
|
4 |
|
5 |
|
6 |
adjectives = ['ambitious', 'assertive', 'committed', 'compassionate', 'confident', 'considerate', 'decisive', 'determined', 'emotional', 'gentle',
|
@@ -40,7 +41,7 @@ def get_nearest(adjective, profession, model, no):
|
|
40 |
neighbor_captions = [caption.split("/")[-1] for caption in neighbors["image_path"]]
|
41 |
# neighbor_captions = [' '.join(caption.split("_")[4:-3]) for caption in neighbor_captions]
|
42 |
neighbor_models = neighbors["model"]
|
43 |
-
neighbor_captions = [f"{a} {b}" for a,b in zip(neighbor_captions,neighbor_models)]
|
44 |
return image, list(zip(neighbor_images, neighbor_captions))
|
45 |
|
46 |
with gr.Blocks() as demo:
|
|
|
1 |
import gradio as gr
|
2 |
from datasets import load_from_disk
|
3 |
import numpy as np
|
4 |
+
import re
|
5 |
|
6 |
|
7 |
adjectives = ['ambitious', 'assertive', 'committed', 'compassionate', 'confident', 'considerate', 'decisive', 'determined', 'emotional', 'gentle',
|
|
|
41 |
neighbor_captions = [caption.split("/")[-1] for caption in neighbors["image_path"]]
|
42 |
# neighbor_captions = [' '.join(caption.split("_")[4:-3]) for caption in neighbor_captions]
|
43 |
neighbor_models = neighbors["model"]
|
44 |
+
neighbor_captions = [f"{re.split("Photo_portrait_of_an?_", a)[-1]} {b}" for a,b in zip(neighbor_captions,neighbor_models)]
|
45 |
return image, list(zip(neighbor_images, neighbor_captions))
|
46 |
|
47 |
with gr.Blocks() as demo:
|