Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable file uploads from both local and/ or Google Drive in Gradio? #8894

Open
1 task done
Tobsad opened this issue Jul 24, 2024 · 0 comments
Open
1 task done

Enable file uploads from both local and/ or Google Drive in Gradio? #8894

Tobsad opened this issue Jul 24, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@Tobsad
Copy link

Tobsad commented Jul 24, 2024

Describe the bug

Hello,

I'm using Gradio for a project and would like to enable users to upload documents either from their local computer or directly from Google Drive. Could provide guidance or examples on how to implement this feature?

Any tips on handling the authentication for Google Drive or managing the files once they're uploaded would be greatly appreciated!

I see that there is a gr.MultimodalTextbox component but it only takes local files.

Have you searched existing issues? 🔎

  • I have searched and found no existing issues

Reproduction

import gradio as gr

with gr.Blocks() as bloque:
    show_btn = gr.Button("Show Modal")
    chatbot = gr.Chatbot(likeable=True,show_share_button=True)
    message_prompt = gr.MultimodalTextbox(interactive=True)

    def saludo(msg,chatbot):
        print(msg['text'])
        print(msg['files'])


        if msg['files'] == []:
            #Fn Response with doc...
            chatbot.append((msg['text'], "Response without doc"))
            return {"text": "", "files": msg['files']}, chatbot
        else:
            #Fn Response withoud doc...
            chatbot.append((msg['text'], "Response with doc"))
            return {"text": "", "files": msg['files']}, chatbot 
        
    message_prompt.submit(saludo,[message_prompt,chatbot],[message_prompt,chatbot])

bloque.launch()

Screenshot

No response

Logs

No response

System Info

gradio                    4.39.0
gradio_client             1.1.1

Severity

I can work around it

@Tobsad Tobsad added the bug Something isn't working label Jul 24, 2024
@abidlabs abidlabs added enhancement New feature or request and removed bug Something isn't working labels Jul 24, 2024
@abidlabs abidlabs changed the title How to enable file uploads from both local and/ or Google Drive in Gradio? Enable file uploads from both local and/ or Google Drive in Gradio? Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants