Update app.py
Browse files
app.py
CHANGED
|
@@ -127,7 +127,7 @@ def handle_input(user_prompt, image=None, audio=None, websearch=False, document=
|
|
| 127 |
model="whisper-large-v3"
|
| 128 |
)
|
| 129 |
user_prompt = transcription.text
|
| 130 |
-
response = llm.
|
| 131 |
audio_output = play_voice_output(response)
|
| 132 |
return "Response generated.", audio_output
|
| 133 |
|
|
@@ -159,7 +159,7 @@ def handle_input(user_prompt, image=None, audio=None, websearch=False, document=
|
|
| 159 |
image.save("output.jpg")
|
| 160 |
return "output.jpg", None
|
| 161 |
|
| 162 |
-
elif function == "
|
| 163 |
print("Executing Image Description")
|
| 164 |
if image:
|
| 165 |
image = Image.open(image).convert('RGB')
|
|
@@ -169,7 +169,7 @@ def handle_input(user_prompt, image=None, audio=None, websearch=False, document=
|
|
| 169 |
else:
|
| 170 |
return "Please upload an image.", None
|
| 171 |
|
| 172 |
-
elif function == "
|
| 173 |
print("Executing Document Summarization")
|
| 174 |
if document:
|
| 175 |
document_qa = DocumentQuestionAnswering(document)
|
|
@@ -180,7 +180,7 @@ def handle_input(user_prompt, image=None, audio=None, websearch=False, document=
|
|
| 180 |
|
| 181 |
else: # function == "text_to_text"
|
| 182 |
print("Executing Text-to-Text")
|
| 183 |
-
response = llm.
|
| 184 |
return response, None
|
| 185 |
|
| 186 |
# Main interface function
|
|
|
|
| 127 |
model="whisper-large-v3"
|
| 128 |
)
|
| 129 |
user_prompt = transcription.text
|
| 130 |
+
response = llm.invoke(query=user_prompt)
|
| 131 |
audio_output = play_voice_output(response)
|
| 132 |
return "Response generated.", audio_output
|
| 133 |
|
|
|
|
| 159 |
image.save("output.jpg")
|
| 160 |
return "output.jpg", None
|
| 161 |
|
| 162 |
+
elif function == "image_vqa":
|
| 163 |
print("Executing Image Description")
|
| 164 |
if image:
|
| 165 |
image = Image.open(image).convert('RGB')
|
|
|
|
| 169 |
else:
|
| 170 |
return "Please upload an image.", None
|
| 171 |
|
| 172 |
+
elif function == "document_qa":
|
| 173 |
print("Executing Document Summarization")
|
| 174 |
if document:
|
| 175 |
document_qa = DocumentQuestionAnswering(document)
|
|
|
|
| 180 |
|
| 181 |
else: # function == "text_to_text"
|
| 182 |
print("Executing Text-to-Text")
|
| 183 |
+
response = llm.invoke(query=user_prompt)
|
| 184 |
return response, None
|
| 185 |
|
| 186 |
# Main interface function
|