Spaces:
Running
Running
Create prompt_list_generator.py
Browse files- prompt_list_generator.py +59 -0
prompt_list_generator.py
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from gradio_client import Client, file
|
2 |
+
import os
|
3 |
+
token = os.getenv('HF_TOKEN')
|
4 |
+
client = Client("K00B404/HugChatWrap", hf_token=token)
|
5 |
+
|
6 |
+
def generate(style="dragon themed",x_imgs=3):
|
7 |
+
client.predict(
|
8 |
+
api_name="/_pop_last_user_message"
|
9 |
+
)
|
10 |
+
|
11 |
+
client.predict(
|
12 |
+
api_name="/lambda_6"
|
13 |
+
)
|
14 |
+
|
15 |
+
client.predict(
|
16 |
+
api_name="/_append_message_to_history_1"
|
17 |
+
)
|
18 |
+
|
19 |
+
client.predict(
|
20 |
+
api_name="/lambda_2"
|
21 |
+
)
|
22 |
+
|
23 |
+
client.predict(
|
24 |
+
param_2=None,
|
25 |
+
param_3=None,
|
26 |
+
param_4=You are a expert prompt engineer, and specialize in visual description prompts for image generation models.,
|
27 |
+
param_5=2048,
|
28 |
+
api_name="/_stream_fn_1"
|
29 |
+
)
|
30 |
+
|
31 |
+
client.predict(
|
32 |
+
api_name="/lambda_8"
|
33 |
+
)
|
34 |
+
|
35 |
+
img_list=client.predict(
|
36 |
+
x=[f"""make a python list of {x_imgs} visual descriptions as prompts for a image generation model, inspired by [{style}] ,
|
37 |
+
make sure the prompts are ramdom , eleborate, and describe mindblowing details.
|
38 |
+
example response:
|
39 |
+
[
|
40 |
+
'In a realm of shimmering quartz crystal veins, a mythical phoenix soars amidst the cosmic dance of constellations, its plumage a dazzling display of hues that defy imagination.',
|
41 |
+
'A breathtaking panorama of a snow-capped mountain range, where ancient glaciers have carved out a landscape of icy wonder, their pristine whiteness beckoning to the keen eye.',
|
42 |
+
'A kaleidoscope of color, as a living tapestry of bioluminescent algae unfolds across the surface of a deep-sea vortex, their soft glow illuminating the surrounding darkness in a mesmerizing display of nature's grand spectacle.'
|
43 |
+
]
|
44 |
+
"""],
|
45 |
+
api_name="/lambda_3"
|
46 |
+
)
|
47 |
+
|
48 |
+
client.predict(
|
49 |
+
api_name="/lambda_4"
|
50 |
+
)
|
51 |
+
|
52 |
+
client.predict(
|
53 |
+
saved_conversations=None,
|
54 |
+
api_name="/_save_conversation_1"
|
55 |
+
)
|
56 |
+
return img_list
|
57 |
+
|
58 |
+
if __name__ == '__main__':
|
59 |
+
print(generate("dragon themed",3))
|