fixed image importing functions

This commit is contained in:
Saifeddine ALOUI 2024-05-19 18:06:39 +02:00
parent c2c008b538
commit be9fdafce8
3 changed files with 8 additions and 8 deletions

View File

@ -11,7 +11,7 @@ import sys
from functools import partial
def select_image_file(client):
def select_image_file(processor, client):
app = QtWidgets.QApplication(sys.argv)
options = QtWidgets.QFileDialog.Options()
options |= QtWidgets.QFileDialog.ReadOnly

View File

@ -72,7 +72,7 @@ class CameraWindow(QtWidgets.QWidget):
self.cap.release()
event.accept()
def take_photo(client, use_ui=False):
def take_photo(processor, client, use_ui=False):
if use_ui:
def run_app():
app = QtWidgets.QApplication(sys.argv)
@ -116,10 +116,10 @@ def take_photo(client, use_ui=False):
return f'<img src="{discussion_path_to_url(fn_view)}" width="80%"></img>'
def take_a_photo_function(processor, client):
def take_a_photo_function(processor, client, use_ui = False):
return {
"function_name": "build_image",
"function": partial(take_photo, processor=processor, client=client),
"function_description": "Builds and shows an image from a prompt and width and height parameters. A square 1024x1024, a portrait woudl be 1024x1820 or landscape 1820x1024.",
"function_parameters": [{"name": "prompt", "type": "str"}, {"name": "width", "type": "int"}, {"name": "height", "type": "int"}]
"function_name": "take_photo",
"function": partial(take_photo, processor=processor, client=client, use_ui = use_ui),
"function_description": "Uses the webcam to take a photo, displays it so that you can take a look.",
"function_parameters": []
}

View File

@ -3443,7 +3443,7 @@ The AI should respond in this format using data from actions_list:
if len(function_calls)>0:
outputs = self.execute_function_calls(function_calls,function_definitions)
out += "\n!@>function calls results:\n" + "\n".join([str(o) for o in outputs])
prompt += out + "!@>"+self.personality.name+":"
prompt += out +"\n"+ "!@>"+self.personality.name+":"
if len(self.personality.image_files)>0:
out, function_calls = self.generate_with_function_calls_and_images(prompt, self.personality.image_files, function_definitions)
else: