gokaygokay commited on
Commit
657a815
1 Parent(s): 81eabf5
Files changed (2) hide show
  1. app.py +2 -1
  2. llm_inference.py +3 -2
app.py CHANGED
@@ -71,7 +71,7 @@ def create_interface():
71
  generate_button = gr.Button("Generate Prompt")
72
  with gr.Row():
73
  text_output = gr.Textbox(label="LLM Generated Text", lines=10, show_copy_button=True)
74
- image_output = gr.Image(label="Generated Image", type="pil")
75
 
76
  # Updated Models based on provider
77
  def update_model_choices(provider):
@@ -168,6 +168,7 @@ def create_interface():
168
  try:
169
  seed = random.randint(0, 1000000)
170
  image_path = llm_node.generate_image(text, seed=seed)
 
171
  return image_path
172
  except Exception as e:
173
  print(f"An error occurred while generating the image: {e}")
 
71
  generate_button = gr.Button("Generate Prompt")
72
  with gr.Row():
73
  text_output = gr.Textbox(label="LLM Generated Text", lines=10, show_copy_button=True)
74
+ image_output = gr.Image(label="Generated Image", type="filepath")
75
 
76
  # Updated Models based on provider
77
  def update_model_choices(provider):
 
168
  try:
169
  seed = random.randint(0, 1000000)
170
  image_path = llm_node.generate_image(text, seed=seed)
171
+ print(f"Image generated: {image_path}")
172
  return image_path
173
  except Exception as e:
174
  print(f"An error occurred while generating the image: {e}")
llm_inference.py CHANGED
@@ -253,7 +253,8 @@ Your output is only the caption itself, no comments or extra formatting. The cap
253
  height=height,
254
  api_name="/generate_image"
255
  )
256
- print(result)
257
- return result
 
258
  except Exception as e:
259
  raise Exception(f"Error generating image: {str(e)}")
 
253
  height=height,
254
  api_name="/generate_image"
255
  )
256
+ # Extract the image path from the result tuple
257
+ image_path = result[0]
258
+ return image_path
259
  except Exception as e:
260
  raise Exception(f"Error generating image: {str(e)}")