merve HF staff commited on
Commit
0a3cbad
·
1 Parent(s): 9dd2eea

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -3,6 +3,7 @@ import os
3
  import json
4
  import requests
5
  import openai
 
6
 
7
  #Streaming endpoint
8
  API_URL = "https://api.openai.com/v1/chat/completions"
@@ -17,7 +18,8 @@ stable_diffusion = gr.Blocks.load(name="spaces/runwayml/stable-diffusion-v1-5")
17
 
18
  def get_images(username):
19
  prompt_string = query(username)
20
- prompt_list = [element.split(". ")[1] for element in prompt_string.split(", ")]
 
21
  prompt_list_prepend = [f"an photo of {item}, photorealistic, coherent, high quality, rendered in unreal engine" for item in prompt_list]
22
  print(prompt_list_prepend)
23
 
 
3
  import json
4
  import requests
5
  import openai
6
+ import re
7
 
8
  #Streaming endpoint
9
  API_URL = "https://api.openai.com/v1/chat/completions"
 
18
 
19
  def get_images(username):
20
  prompt_string = query(username)
21
+ regexed_prompt_string = re.sub(r'@\w+', '', prompt_string)
22
+ prompt_list = [element.split(". ")[1] for element in regexed_prompt_string.split(", ")]
23
  prompt_list_prepend = [f"an photo of {item}, photorealistic, coherent, high quality, rendered in unreal engine" for item in prompt_list]
24
  print(prompt_list_prepend)
25