Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -89,26 +89,23 @@ class BasicAgent:
|
|
89 |
print_coso(f"__call__ file_info: {file_info}")
|
90 |
|
91 |
# Se è presente un file, gestiscilo
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
print("coso Text file detected")
|
110 |
-
text_content = self._load_text(file_data)
|
111 |
-
return self._ask_gpt4o(text_content)
|
112 |
|
113 |
|
114 |
print_coso("nessun file allegato")
|
|
|
89 |
print_coso(f"__call__ file_info: {file_info}")
|
90 |
|
91 |
# Se è presente un file, gestiscilo
|
92 |
+
|
93 |
+
if file_info.endswith((".png", ".jpg", ".jpeg")):
|
94 |
+
print("coso Image file detected, processing with GPT-4o")
|
95 |
+
image = self._load_image(file_data)
|
96 |
+
response = self._ask_gpt4o_with_image(image, text)
|
97 |
+
return response
|
98 |
+
|
99 |
+
elif file_info.endswith(".wav") or file_name.endswith(".mp3"):
|
100 |
+
print("coso Audio file detected, processing with Whisper")
|
101 |
+
audio_bytes = self._load_bytes(file_data)
|
102 |
+
transcription = self._transcribe_audio(audio_bytes)
|
103 |
+
return self._ask_gpt4o(transcription)
|
104 |
+
|
105 |
+
elif file_info.endswith(".txt"):
|
106 |
+
print("coso Text file detected")
|
107 |
+
text_content = self._load_text(file_data)
|
108 |
+
return self._ask_gpt4o(text_content)
|
|
|
|
|
|
|
109 |
|
110 |
|
111 |
print_coso("nessun file allegato")
|