xh365 commited on
Commit
b18de3e
·
1 Parent(s): 70f494f

update icon

Browse files
Files changed (4) hide show
  1. app.py +9 -6
  2. credentials.json +0 -14
  3. images/icon.png +0 -0
  4. requirements.txt +2 -1
app.py CHANGED
@@ -8,13 +8,14 @@ import re
8
  import transformers
9
  import open_clip
10
 
11
- # Optional: keep these utilities if your pipeline depends on them
 
12
  from optim_utils import optimize_prompt
13
  from utils import (
14
  clean_response_gpt, setup_model, init_gpt_api, call_gpt_api,
15
  get_refine_msg, clean_cache, get_personalize_message,
16
  clean_refined_prompt_response_gpt, IMAGES, OPTIONS, T2I_MODELS,
17
- INSTRUCTION, IMAGE_OPTIONS, PROMPTS, SCENARIOS # some may be unused after simplification
18
  )
19
 
20
  # =========================
@@ -39,7 +40,7 @@ llm_pipe = None
39
  inverted_prompt = ""
40
  torch.cuda.empty_cache()
41
 
42
- METHOD = "Experimental" # keep ONLY experimental
43
  counter = 1
44
  enable_submit = False
45
  responses_memory = {METHOD: {}}
@@ -121,7 +122,6 @@ def invert_prompt(prompt, images, prompt_len=15, iter=500, lr=0.1, batch_size=2)
121
  "clip_pretrain": PRETRAINED_CLIP,
122
  }
123
  inverted_prompt = optimize_prompt(clip_model, preprocess, text_params, device, target_images=images, target_prompts=prompt)
124
- print(inverted_prompt)
125
 
126
  # eval(prompt, learned_prompt, optimized_images, clip_model, preprocess)
127
  # return learned_prompt
@@ -312,7 +312,8 @@ css = """
312
  with gr.Blocks(theme=gr.themes.Soft(font=[gr.themes.GoogleFont("Inconsolata"), "Arial", "sans-serif"]), css=css) as demo:
313
  with gr.Column(elem_id="col-container", elem_classes=["header-section"]):
314
  gr.Markdown("# 📌 **POET**")
315
- gr.Markdown("## Supporting Prompting Creativity with Automated Expansion of Text-to-Image Generation")
 
316
 
317
  # <strong>Abstract:</strong> State-of-the-art visual generative AI tools hold immense potential to assist users in the early ideation stages of creative tasks — offering the ability to generate (rather than search for) novel and unprecedented (instead of existing) images of considerable quality that also adhere to boundless combinations of user specifications. However, many large-scale text-to-image systems are designed for broad applicability, yielding conventional output that may limit creative exploration. They also employ interaction methods that may be difficult for beginners. #
318
  gr.Markdown("""
@@ -333,7 +334,9 @@ with gr.Blocks(theme=gr.themes.Soft(font=[gr.themes.GoogleFont("Inconsolata"), "
333
  # Authors
334
  gr.Markdown("""
335
  <div class="authors-section">
336
- Evans Han, Alice Qian Zhang, Haiyi Zhu, Hong Shen, Paul Pu Liang, Jane Hsieh
 
 
337
  </div>
338
  """, elem_classes=["authors-section"])
339
 
 
8
  import transformers
9
  import open_clip
10
 
11
+ # from Pilot-Phase3.optim_utils import optimize_prompt
12
+ # from Pi
13
  from optim_utils import optimize_prompt
14
  from utils import (
15
  clean_response_gpt, setup_model, init_gpt_api, call_gpt_api,
16
  get_refine_msg, clean_cache, get_personalize_message,
17
  clean_refined_prompt_response_gpt, IMAGES, OPTIONS, T2I_MODELS,
18
+ INSTRUCTION, IMAGE_OPTIONS, PROMPTS, SCENARIOS
19
  )
20
 
21
  # =========================
 
40
  inverted_prompt = ""
41
  torch.cuda.empty_cache()
42
 
43
+ METHOD = "Experimental"
44
  counter = 1
45
  enable_submit = False
46
  responses_memory = {METHOD: {}}
 
122
  "clip_pretrain": PRETRAINED_CLIP,
123
  }
124
  inverted_prompt = optimize_prompt(clip_model, preprocess, text_params, device, target_images=images, target_prompts=prompt)
 
125
 
126
  # eval(prompt, learned_prompt, optimized_images, clip_model, preprocess)
127
  # return learned_prompt
 
312
  with gr.Blocks(theme=gr.themes.Soft(font=[gr.themes.GoogleFont("Inconsolata"), "Arial", "sans-serif"]), css=css) as demo:
313
  with gr.Column(elem_id="col-container", elem_classes=["header-section"]):
314
  gr.Markdown("# 📌 **POET**")
315
+ gr.HTML('<div><img src="images/icon.png" width="200"></div>')
316
+ gr.Markdown("### Supporting Prompting Creativity with Automated Expansion of Text-to-Image Generation")
317
 
318
  # <strong>Abstract:</strong> State-of-the-art visual generative AI tools hold immense potential to assist users in the early ideation stages of creative tasks — offering the ability to generate (rather than search for) novel and unprecedented (instead of existing) images of considerable quality that also adhere to boundless combinations of user specifications. However, many large-scale text-to-image systems are designed for broad applicability, yielding conventional output that may limit creative exploration. They also employ interaction methods that may be difficult for beginners. #
319
  gr.Markdown("""
 
334
  # Authors
335
  gr.Markdown("""
336
  <div class="authors-section">
337
+ <a href="https://scholar.google.com/citations?user=HXED4kIAAAAJ&hl=en">Evans Han</a>, <a href"https://www.aliceqian.com/">Alice Qian Zhang</a>,
338
+ <a href="https://haiyizhu.com/">Haiyi Zhu</a>, <a href="https://www.andrew.cmu.edu/user/hongs/">Hong Shen</a>,
339
+ <a href="https://pliang279.github.io/">Paul Pu Liang</a>, <a href="https://janeon.github.io/">Jane Hsieh</a>
340
  </div>
341
  """, elem_classes=["authors-section"])
342
 
credentials.json DELETED
@@ -1,14 +0,0 @@
1
- {
2
- "type": "service_account",
3
- "project_id": "fairness-452723",
4
- "private_key_id": "6ef19457273e863d3d6c7d43fc26c020332f4534",
5
- "private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQCiluCojZiakBgJ\nl2reacq+fq5WOsDypOZioGeKqbmaxKJn7H610PCl+jMdvTcgX4IGgTHFkZHwcncj\n72NK+9nAkgdGLQ90jcomY/UkUFozW+83igcvTURw9q9K5Jwuu7HjLE7CWIGQwcFf\nl38fSRxxGXk3qI2XUbTYrloeoLB9asHtm9/EkufMaI7Be23GojC6dXwU9V5x6Wn6\nPd0AFHQV/frQpxLj44SG4nGCgSq9Av6A4BULCeyiCTw8BJaecZxJ5gyW8RrhdX20\np76BIUTGfGuizZeZfX6437qGh2RjoF2yC+6FK7AdN4p4nugBqO10E2bDrg1EtEaZ\nxZdwfs0nAgMBAAECggEAH3o2ZGuFb+cVwEWgWw8AQYElH2ygjll+gPmtEhtp45zO\nFHCk125sKLYXz1oiohHbiobYq/dS2cpPZpWiE5JOxgl/fwaaR2ZsDKKtgypLTEYw\nOgBvA6lh5rzbkx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fWdQqd7jJjvwwF8uFU61//OD\n7mJo9qdX51m/NAB6i689JIakXQ==\n-----END PRIVATE KEY-----\n",
6
- "client_email": "[email protected]",
7
- "client_id": "111082330112077835833",
8
- "auth_uri": "https://accounts.google.com/o/oauth2/auth",
9
- "token_uri": "https://oauth2.googleapis.com/token",
10
- "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
11
- "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/fairnessgroup%40fairness-452723.iam.gserviceaccount.com",
12
- "universe_domain": "googleapis.com"
13
- }
14
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
images/icon.png ADDED
requirements.txt CHANGED
@@ -14,4 +14,5 @@ open-clip-torch==2.24.0
14
  gspread
15
  google-api-python-client
16
  google-auth-httplib2
17
- google-auth-oauthlib
 
 
14
  gspread
15
  google-api-python-client
16
  google-auth-httplib2
17
+ google-auth-oauthlib
18
+ # git+https://xh365:${HF_TOKEN}@huggingface.co/spaces/PAI-GEN/Pilot-Phase3.git