Maga222006
commited on
Commit
·
c8f6495
1
Parent(s):
29082ec
MultiagentPersonalAssistant
Browse files
__pycache__/app.cpython-312.pyc
CHANGED
|
Binary files a/__pycache__/app.cpython-312.pyc and b/__pycache__/app.cpython-312.pyc differ
|
|
|
agent/__pycache__/file_preprocessing.cpython-312.pyc
CHANGED
|
Binary files a/agent/__pycache__/file_preprocessing.cpython-312.pyc and b/agent/__pycache__/file_preprocessing.cpython-312.pyc differ
|
|
|
app.py
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
|
|
| 1 |
from fastapi import FastAPI, UploadFile, File, HTTPException
|
| 2 |
-
from agent.file_preprocessing import preprocess_file
|
| 3 |
from langchain_core.messages import HumanMessage
|
| 4 |
from agent.multi_agent import Assistant
|
| 5 |
from typing import Any, Dict
|
| 6 |
from fastapi import Form
|
| 7 |
from pathlib import Path
|
|
|
|
| 8 |
import json
|
| 9 |
import os
|
| 10 |
|
|
@@ -14,7 +15,7 @@ MEDIA_DIR = Path("mediafiles")
|
|
| 14 |
app = FastAPI()
|
| 15 |
|
| 16 |
@app.post("/voice")
|
| 17 |
-
async def
|
| 18 |
state: str = Form(...),
|
| 19 |
file: UploadFile = File(...)
|
| 20 |
) -> Dict[str, Any]:
|
|
@@ -34,7 +35,7 @@ async def file_mode(
|
|
| 34 |
await assistant.authorization()
|
| 35 |
|
| 36 |
# Preprocess file
|
| 37 |
-
transcription = await
|
| 38 |
state_data["message"] = HumanMessage(
|
| 39 |
content=transcription
|
| 40 |
)
|
|
@@ -45,7 +46,7 @@ async def file_mode(
|
|
| 45 |
return response
|
| 46 |
|
| 47 |
@app.post("/image")
|
| 48 |
-
async def
|
| 49 |
state: str = Form(...),
|
| 50 |
file: UploadFile = File(...)
|
| 51 |
) -> Dict[str, Any]:
|
|
|
|
| 1 |
+
from agent.file_preprocessing import preprocess_file, preprocess_audio
|
| 2 |
from fastapi import FastAPI, UploadFile, File, HTTPException
|
|
|
|
| 3 |
from langchain_core.messages import HumanMessage
|
| 4 |
from agent.multi_agent import Assistant
|
| 5 |
from typing import Any, Dict
|
| 6 |
from fastapi import Form
|
| 7 |
from pathlib import Path
|
| 8 |
+
import asyncio
|
| 9 |
import json
|
| 10 |
import os
|
| 11 |
|
|
|
|
| 15 |
app = FastAPI()
|
| 16 |
|
| 17 |
@app.post("/voice")
|
| 18 |
+
async def voice_mode(
|
| 19 |
state: str = Form(...),
|
| 20 |
file: UploadFile = File(...)
|
| 21 |
) -> Dict[str, Any]:
|
|
|
|
| 35 |
await assistant.authorization()
|
| 36 |
|
| 37 |
# Preprocess file
|
| 38 |
+
transcription = await asyncio.to_thread(preprocess_audio, str(dest))
|
| 39 |
state_data["message"] = HumanMessage(
|
| 40 |
content=transcription
|
| 41 |
)
|
|
|
|
| 46 |
return response
|
| 47 |
|
| 48 |
@app.post("/image")
|
| 49 |
+
async def image_mode(
|
| 50 |
state: str = Form(...),
|
| 51 |
file: UploadFile = File(...)
|
| 52 |
) -> Dict[str, Any]:
|
database_files/main.db
CHANGED
|
Binary files a/database_files/main.db and b/database_files/main.db differ
|
|
|