K00B404 commited on
Commit
01798da
1 Parent(s): 345b036

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import gradio as gr
2
  import requests
3
  import io
@@ -27,13 +28,18 @@ def set_system_prompt():
27
  # Function to enhance the prompt with Qwen model
28
  def enhance_prompt_with_qwen(prompt):
29
  client = Client("Qwen/Qwen2.5-72B-Instruct")
30
- result,_,__ = client.predict(
31
  query=prompt,
32
  history=[],
33
  system="You are Qwen, an image generation prompt enhancer",
34
  api_name="/model_chat"
35
  )
36
- return str(result) # Assuming the enhanced prompt is under 'output'
 
 
 
 
 
37
 
38
  # Image generation query function
39
  def query(prompt, is_negative=False, steps=30, cfg_scale=7, sampler="DPM++ 2M Karras", seed=-1, strength=0.7, huggingface_api_key=None, use_dev=False):
 
1
+
2
  import gradio as gr
3
  import requests
4
  import io
 
28
  # Function to enhance the prompt with Qwen model
29
  def enhance_prompt_with_qwen(prompt):
30
  client = Client("Qwen/Qwen2.5-72B-Instruct")
31
+ result = client.predict(
32
  query=prompt,
33
  history=[],
34
  system="You are Qwen, an image generation prompt enhancer",
35
  api_name="/model_chat"
36
  )
37
+
38
+ # Extract the relevant part of the tuple, index [0], which contains the enhanced prompt.
39
+ enhanced_prompt = result[0] # This is the string we need for the image generation prompt.
40
+
41
+ print(f"Enhanced prompt: {enhanced_prompt}")
42
+ return enhanced_prompt
43
 
44
  # Image generation query function
45
  def query(prompt, is_negative=False, steps=30, cfg_scale=7, sampler="DPM++ 2M Karras", seed=-1, strength=0.7, huggingface_api_key=None, use_dev=False):