-
Notifications
You must be signed in to change notification settings - Fork 799
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix file assignment in gradio interface #125
- Loading branch information
Showing
6 changed files
with
91 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
from .cli.create_agent_template import create_agent_template | ||
from .cli.import_agent import import_agent | ||
from .oai import set_openai_key, get_openai_client, set_openai_client | ||
from .oai import set_openai_key, get_openai_client, set_openai_client | ||
from .files import determine_file_type |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import mimetypes | ||
|
||
def determine_file_type(file_path): | ||
mime_type, _ = mimetypes.guess_type(file_path) | ||
if mime_type: | ||
if mime_type in [ | ||
'application/json', 'text/csv', 'application/xml', | ||
'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', | ||
'application/zip' | ||
]: | ||
return "assistants.code_interpreter" | ||
elif mime_type in [ | ||
'text/plain', 'text/markdown', 'application/pdf', | ||
'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' | ||
]: | ||
return "assistants.file_search" | ||
elif mime_type.startswith('image/'): | ||
return "vision" | ||
return "assistants.file_search" |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters