Spaces:
Runtime error
Runtime error
Amovane commited on
Commit ·
b0a0980
1
Parent(s): 2094e34
optimize: tweak prompt
Browse files
app.ipynb
CHANGED
|
@@ -35,14 +35,14 @@
|
|
| 35 |
},
|
| 36 |
{
|
| 37 |
"cell_type": "code",
|
| 38 |
-
"execution_count":
|
| 39 |
"metadata": {},
|
| 40 |
"outputs": [
|
| 41 |
{
|
| 42 |
"name": "stdout",
|
| 43 |
"output_type": "stream",
|
| 44 |
"text": [
|
| 45 |
-
"Running on local URL: http://127.0.0.1:
|
| 46 |
"\n",
|
| 47 |
"To create a public link, set `share=True` in `launch()`.\n"
|
| 48 |
]
|
|
@@ -50,7 +50,7 @@
|
|
| 50 |
{
|
| 51 |
"data": {
|
| 52 |
"text/html": [
|
| 53 |
-
"<div><iframe src=\"http://127.0.0.1:
|
| 54 |
],
|
| 55 |
"text/plain": [
|
| 56 |
"<IPython.core.display.HTML object>"
|
|
@@ -63,9 +63,23 @@
|
|
| 63 |
"data": {
|
| 64 |
"text/plain": []
|
| 65 |
},
|
| 66 |
-
"execution_count":
|
| 67 |
"metadata": {},
|
| 68 |
"output_type": "execute_result"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
}
|
| 70 |
],
|
| 71 |
"source": [
|
|
@@ -85,18 +99,27 @@
|
|
| 85 |
"\n",
|
| 86 |
"def build_prompt(desc) -> str:\n",
|
| 87 |
" return f\"\"\"\n",
|
| 88 |
-
" I would like you to act as an
|
| 89 |
-
" Create a logo for a company called '{desc.name}' \n",
|
| 90 |
" The company specializes in {desc.industry} research and development. \n",
|
| 91 |
" The logo should convey a sense of {desc.color_scheme}, {desc.font_style}, \n",
|
| 92 |
" and the microscopic world of {desc.industry}. \n",
|
| 93 |
" Use a color scheme that represents {desc.color_scheme}. \n",
|
| 94 |
" \"\"\"\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
"\n",
|
| 96 |
"def ganerate(logo_name, slogan, industry, color_scheme, font_style):\n",
|
| 97 |
" n = 1\n",
|
| 98 |
" logo = Logo(logo_name, slogan, industry, color_scheme, font_style)\n",
|
| 99 |
" prompt = build_prompt(logo)\n",
|
|
|
|
| 100 |
" size=\"256x256\"\n",
|
| 101 |
" data = {\"n\": n, \"prompt\": prompt, \"size\": size}\n",
|
| 102 |
" headers = {\"Content-Type\": \"application/json\",\"Authorization\": f\"\"\"Bearer {openai_key}\"\"\"}\n",
|
|
|
|
| 35 |
},
|
| 36 |
{
|
| 37 |
"cell_type": "code",
|
| 38 |
+
"execution_count": 20,
|
| 39 |
"metadata": {},
|
| 40 |
"outputs": [
|
| 41 |
{
|
| 42 |
"name": "stdout",
|
| 43 |
"output_type": "stream",
|
| 44 |
"text": [
|
| 45 |
+
"Running on local URL: http://127.0.0.1:7878\n",
|
| 46 |
"\n",
|
| 47 |
"To create a public link, set `share=True` in `launch()`.\n"
|
| 48 |
]
|
|
|
|
| 50 |
{
|
| 51 |
"data": {
|
| 52 |
"text/html": [
|
| 53 |
+
"<div><iframe src=\"http://127.0.0.1:7878/\" width=\"100%\" height=\"500\" allow=\"autoplay; camera; microphone; clipboard-read; clipboard-write;\" frameborder=\"0\" allowfullscreen></iframe></div>"
|
| 54 |
],
|
| 55 |
"text/plain": [
|
| 56 |
"<IPython.core.display.HTML object>"
|
|
|
|
| 63 |
"data": {
|
| 64 |
"text/plain": []
|
| 65 |
},
|
| 66 |
+
"execution_count": 20,
|
| 67 |
"metadata": {},
|
| 68 |
"output_type": "execute_result"
|
| 69 |
+
},
|
| 70 |
+
{
|
| 71 |
+
"name": "stdout",
|
| 72 |
+
"output_type": "stream",
|
| 73 |
+
"text": [
|
| 74 |
+
"prompt: \n",
|
| 75 |
+
" I would like you to act as an Logo designer.\n",
|
| 76 |
+
" Create a logo for a company called 'Shareverse',the logo design does not need to include the name. \n",
|
| 77 |
+
" The company specializes in Technology research and development. \n",
|
| 78 |
+
" The logo should convey a sense of Greyscale, Futuristic, \n",
|
| 79 |
+
" and the microscopic world of Technology. \n",
|
| 80 |
+
" Use a color scheme that represents Greyscale. \n",
|
| 81 |
+
" \n"
|
| 82 |
+
]
|
| 83 |
}
|
| 84 |
],
|
| 85 |
"source": [
|
|
|
|
| 99 |
"\n",
|
| 100 |
"def build_prompt(desc) -> str:\n",
|
| 101 |
" return f\"\"\"\n",
|
| 102 |
+
" I would like you to act as an Logo designer.\n",
|
| 103 |
+
" Create a logo for a company called '{desc.name}',the logo design does not need to include the name. \n",
|
| 104 |
" The company specializes in {desc.industry} research and development. \n",
|
| 105 |
" The logo should convey a sense of {desc.color_scheme}, {desc.font_style}, \n",
|
| 106 |
" and the microscopic world of {desc.industry}. \n",
|
| 107 |
" Use a color scheme that represents {desc.color_scheme}. \n",
|
| 108 |
" \"\"\"\n",
|
| 109 |
+
" # return f\"\"\"\n",
|
| 110 |
+
" # Now you are a logo designer, and the name of this logo is '{desc.name}' \n",
|
| 111 |
+
" # The logo design does not need to include the name. \n",
|
| 112 |
+
" # The industry of this logo is {desc.industry}, \n",
|
| 113 |
+
" # and it requires {desc.color_scheme} colors. \n",
|
| 114 |
+
" # The font style should be {desc.font_style}. \n",
|
| 115 |
+
" # Please generate a simple logo with these conditions in 256x256 resolution.\n",
|
| 116 |
+
" # \"\"\"\n",
|
| 117 |
"\n",
|
| 118 |
"def ganerate(logo_name, slogan, industry, color_scheme, font_style):\n",
|
| 119 |
" n = 1\n",
|
| 120 |
" logo = Logo(logo_name, slogan, industry, color_scheme, font_style)\n",
|
| 121 |
" prompt = build_prompt(logo)\n",
|
| 122 |
+
" print(\"prompt: \", prompt)\n",
|
| 123 |
" size=\"256x256\"\n",
|
| 124 |
" data = {\"n\": n, \"prompt\": prompt, \"size\": size}\n",
|
| 125 |
" headers = {\"Content-Type\": \"application/json\",\"Authorization\": f\"\"\"Bearer {openai_key}\"\"\"}\n",
|
app.py
CHANGED
|
@@ -13,8 +13,8 @@ class Logo:
|
|
| 13 |
|
| 14 |
def build_prompt(desc) -> str:
|
| 15 |
return f"""
|
| 16 |
-
I would like you to act as an
|
| 17 |
-
Create a logo for a company called '{desc.name}'
|
| 18 |
The company specializes in {desc.industry} research and development.
|
| 19 |
The logo should convey a sense of {desc.color_scheme}, {desc.font_style},
|
| 20 |
and the microscopic world of {desc.industry}.
|
|
|
|
| 13 |
|
| 14 |
def build_prompt(desc) -> str:
|
| 15 |
return f"""
|
| 16 |
+
I would like you to act as an Logo designer.
|
| 17 |
+
Create a logo for a company called '{desc.name}',the logo design does not need to include the name.
|
| 18 |
The company specializes in {desc.industry} research and development.
|
| 19 |
The logo should convey a sense of {desc.color_scheme}, {desc.font_style},
|
| 20 |
and the microscopic world of {desc.industry}.
|