Spaces:
Runtime error
Runtime error
Commit
·
1ba738b
1
Parent(s):
6318a31
Updates
Browse files
app.py
CHANGED
|
@@ -105,6 +105,7 @@ class BasicAgent:
|
|
| 105 |
file_extension = state["file_path"].split(".")[1]
|
| 106 |
else:
|
| 107 |
file_extension = None
|
|
|
|
| 108 |
|
| 109 |
prompt = f"""
|
| 110 |
You are a helpful assistant.
|
|
@@ -150,7 +151,7 @@ class BasicAgent:
|
|
| 150 |
msg = "File downloaded successfully!!"
|
| 151 |
print(msg)
|
| 152 |
file = response.content
|
| 153 |
-
b64_file = base64.b64encode(
|
| 154 |
else:
|
| 155 |
msg = "There was an error downloading the file."
|
| 156 |
print(msg)
|
|
@@ -197,6 +198,8 @@ class BasicAgent:
|
|
| 197 |
message = {"type": "media", "data": encoded_file, # Use base64 string directly
|
| 198 |
"mime_type": "audio/mpeg",
|
| 199 |
}
|
|
|
|
|
|
|
| 200 |
|
| 201 |
message_local = HumanMessage(
|
| 202 |
content=[
|
|
@@ -209,7 +212,7 @@ class BasicAgent:
|
|
| 209 |
model="gemini-2.0-flash",
|
| 210 |
temperature=0)
|
| 211 |
|
| 212 |
-
response = llm.invoke(message_local)
|
| 213 |
|
| 214 |
return response
|
| 215 |
|
|
|
|
| 105 |
file_extension = state["file_path"].split(".")[1]
|
| 106 |
else:
|
| 107 |
file_extension = None
|
| 108 |
+
file_name = None
|
| 109 |
|
| 110 |
prompt = f"""
|
| 111 |
You are a helpful assistant.
|
|
|
|
| 151 |
msg = "File downloaded successfully!!"
|
| 152 |
print(msg)
|
| 153 |
file = response.content
|
| 154 |
+
b64_file = base64.b64encode(file).decode("utf-8")
|
| 155 |
else:
|
| 156 |
msg = "There was an error downloading the file."
|
| 157 |
print(msg)
|
|
|
|
| 198 |
message = {"type": "media", "data": encoded_file, # Use base64 string directly
|
| 199 |
"mime_type": "audio/mpeg",
|
| 200 |
}
|
| 201 |
+
else:
|
| 202 |
+
message = {"type": "text", "text": "The file is not supported."}
|
| 203 |
|
| 204 |
message_local = HumanMessage(
|
| 205 |
content=[
|
|
|
|
| 212 |
model="gemini-2.0-flash",
|
| 213 |
temperature=0)
|
| 214 |
|
| 215 |
+
response = llm.invoke([message_local])
|
| 216 |
|
| 217 |
return response
|
| 218 |
|