Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -140,11 +140,13 @@ def response_audio(state:AppState, progress=gr.Progress(track_tqdm=True)):
|
|
140 |
return state, synthesize_speech("Đã chuyển sang chế độ " + ("vẽ" if state.painting else "nói chuyện"))
|
141 |
if state.painting is True:
|
142 |
promptx = prompt_hugingface(textin,"Hugging Face","Qwen/Qwen2.5-72B-Instruct","Medium")
|
|
|
143 |
if state.image_in:
|
144 |
img=resize(state.image_in)
|
|
|
145 |
else:
|
146 |
img=None
|
147 |
-
state.image_out = render.generate_images(promptx,img,progress)
|
148 |
audio_bytes = synthesize_speech("Bạn thấy tôi vẽ "+textin+" có đẹp không")
|
149 |
return state, audio_bytes
|
150 |
else:
|
@@ -170,11 +172,13 @@ def response_text(state:AppState,textin,image:Image, prompt,progress=gr.Progress
|
|
170 |
if state.painting is True:
|
171 |
state.conversation.append({"role": "user", "content":"Bạn: " + textin})
|
172 |
#state.image_out = generate_image(textin, image, streng, ckpt,guidance)
|
|
|
173 |
if image:
|
174 |
img=resize(image)
|
|
|
175 |
else:
|
176 |
img=None
|
177 |
-
image_out = render.generate_images(textin,img,progress)
|
178 |
state.image_out = image_out
|
179 |
audio_bytes = synthesize_speech("Bạn thấy tôi vẽ "+prompt+" có đẹp không")
|
180 |
return state, audio_bytes
|
|
|
140 |
return state, synthesize_speech("Đã chuyển sang chế độ " + ("vẽ" if state.painting else "nói chuyện"))
|
141 |
if state.painting is True:
|
142 |
promptx = prompt_hugingface(textin,"Hugging Face","Qwen/Qwen2.5-72B-Instruct","Medium")
|
143 |
+
imgtxt=""
|
144 |
if state.image_in:
|
145 |
img=resize(state.image_in)
|
146 |
+
imgtxt = creator_prompt.img2text(img)
|
147 |
else:
|
148 |
img=None
|
149 |
+
state.image_out = render.generate_images(imgtxt+promptx,img,progress)
|
150 |
audio_bytes = synthesize_speech("Bạn thấy tôi vẽ "+textin+" có đẹp không")
|
151 |
return state, audio_bytes
|
152 |
else:
|
|
|
172 |
if state.painting is True:
|
173 |
state.conversation.append({"role": "user", "content":"Bạn: " + textin})
|
174 |
#state.image_out = generate_image(textin, image, streng, ckpt,guidance)
|
175 |
+
imgtxt=""
|
176 |
if image:
|
177 |
img=resize(image)
|
178 |
+
imgtxt = creator_prompt.img2text(img)
|
179 |
else:
|
180 |
img=None
|
181 |
+
image_out = render.generate_images(imgtxt+textin,img,progress)
|
182 |
state.image_out = image_out
|
183 |
audio_bytes = synthesize_speech("Bạn thấy tôi vẽ "+prompt+" có đẹp không")
|
184 |
return state, audio_bytes
|