servers hate libmagic i guess

This commit is contained in:
salt
2024-04-09 17:02:24 -07:00
parent 4412cf69f8
commit 08293ed06e
2 changed files with 3 additions and 4 deletions
+2 -2
View File
@@ -10,13 +10,13 @@ import os
import json
import random
from typing import Dict, Any, Optional
import mimetypes
from fastapi import FastAPI, File, UploadFile, HTTPException, Form
from fastapi.responses import FileResponse
import requests
from jsonpath_ng import jsonpath, parse
from moviepy.editor import ImageClip
import magic
app = FastAPI()
lock = asyncio.Lock() # Create an asyncio lock
@@ -129,7 +129,7 @@ async def preview_request(request: str = Form(...), input_file: UploadFile = Fil
with open(temp_filename, "wb") as buffer:
shutil.copyfileobj(input_file.file, buffer)
mime_type = magic.from_file(temp_filename, mime=True)
mime_type, _ = mimetypes.guess_type(temp_filename)
if 'video' in mime_type:
input_filename = f"{temp_filename}.mp4"
@@ -4,5 +4,4 @@ fastapi~=0.110.0
python-multipart~=0.0.9
pydantic~=2.6.4
jsonpath-ng~=1.6.1
moviepy
python-magic
moviepy