linoyts HF Staff commited on
Commit
0d5afae
·
verified ·
1 Parent(s): cada4f8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -23
app.py CHANGED
@@ -6,6 +6,7 @@ import spaces
6
 
7
  from PIL import Image
8
  from diffusers import QwenImageEditPlusPipeline, FlowMatchEulerDiscreteScheduler
 
9
  import math
10
 
11
  import os
@@ -153,29 +154,7 @@ def polish_prompt_hf(prompt, img):
153
  print(f"Error during API call to Hugging Face: {e}")
154
  # Fallback to original prompt if enhancement fails
155
  return prompt
156
-
157
- # def polish_prompt(prompt, img):
158
- # prompt = f"{SYSTEM_PROMPT}\n\nUser Input: {prompt}\n\nRewritten Prompt:"
159
- # success=False
160
- # while not success:
161
- # try:
162
- # result = api(prompt, [img])
163
- # # print(f"Result: {result}")
164
- # # print(f"Polished Prompt: {polished_prompt}")
165
- # if isinstance(result, str):
166
- # result = result.replace('```json','')
167
- # result = result.replace('```','')
168
- # result = json.loads(result)
169
- # else:
170
- # result = json.loads(result)
171
-
172
- # polished_prompt = result['Rewritten']
173
- # polished_prompt = polished_prompt.strip()
174
- # polished_prompt = polished_prompt.replace("\n", " ")
175
- # success = True
176
- # except Exception as e:
177
- # print(f"[Warning] Error during API call: {e}")
178
- # return polished_prompt
179
 
180
 
181
  def encode_image(pil_image):
 
6
 
7
  from PIL import Image
8
  from diffusers import QwenImageEditPlusPipeline, FlowMatchEulerDiscreteScheduler
9
+ from huggingface_hub import InferenceClient
10
  import math
11
 
12
  import os
 
154
  print(f"Error during API call to Hugging Face: {e}")
155
  # Fallback to original prompt if enhancement fails
156
  return prompt
157
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
158
 
159
 
160
  def encode_image(pil_image):