Giter Club home page Giter Club logo

Comments (9)

abidlabs avatar abidlabs commented on September 27, 2024 1

Ok thanks for clarifying, yes if you are just doing it for local use, you can use gr.FileExplorer. It is possible to allow selecting directories, but its not well-documented. Can you try:

import gradio as gr

with gr.Blocks() as demo:
    gr.FileExplorer(glob="**/")

demo.launch()

We'll update the docs to make this clearer

from gradio.

abidlabs avatar abidlabs commented on September 27, 2024

Do you need to select a folder on the developer's computer (the one hosting the Gradio app), or on the user's computer (i.e. you share this on Spaces or with a share link, and the user is selecting a path on their own computer)? Browsers prevent the latter for security reasons, but the former is possible using gr.FileExplorer component

from gradio.

FurkanGozukara avatar FurkanGozukara commented on September 27, 2024

@abidlabs when using on your local device through 127.0.0.1

gr.FileExplorer is for folder or file selection? i want to select folder path like with c# folder selection

using System;
using System.Windows.Forms;

class FolderSelectionExample
{
    static void Main()
    {
        using (var folderDialog = new FolderBrowserDialog())
        {
            folderDialog.Description = "Select a folder";
            folderDialog.RootFolder = Environment.SpecialFolder.MyComputer;
            folderDialog.ShowNewFolderButton = true;

            DialogResult result = folderDialog.ShowDialog();

            if (result == DialogResult.OK && !string.IsNullOrWhiteSpace(folderDialog.SelectedPath))
            {
                string selectedFolder = folderDialog.SelectedPath;
                Console.WriteLine("Selected folder: " + selectedFolder);
            }
            else
            {
                Console.WriteLine("Folder selection canceled or invalid.");
            }
        }

        Console.ReadLine(); // Keep console window open
    }
}

from gradio.

abidlabs avatar abidlabs commented on September 27, 2024

For future reference, this PR contains the relevant discussion: #6689

from gradio.

FurkanGozukara avatar FurkanGozukara commented on September 27, 2024
import gradio as gr

with gr.Blocks() as demo:
    gr.FileExplorer(glob="**/")

demo.launch()

thank you so much

just tested your code and nothing happens :)

Gradio 4.44.0

image

from gradio.

abidlabs avatar abidlabs commented on September 27, 2024

Are there any directories in the working directory of your app? It seems like there aren't. You can set a different working directory using the root_dir parameter

from gradio.

FurkanGozukara avatar FurkanGozukara commented on September 27, 2024

Are there any directories in the working directory of your app? It seems like there aren't. You can set a different working directory using the root_dir parameter

@abidlabs , no i dont mean that. what i mean is like this that kohya gui has implemented

step 1 - click yellow icon

image

step 2 - go to folder

image

step 3 - click select folder

image

step 4 - folder copy pasted into input field

image

from gradio.

abidlabs avatar abidlabs commented on September 27, 2024

To be honest, I'm not sure how they implemented that, since I thought that you couldn't select paths in this way using a file explorer, but maybe its possible. Will have to look. Perhaps they created a custom component, have you taken a look?

from gradio.

FurkanGozukara avatar FurkanGozukara commented on September 27, 2024

To be honest, I'm not sure how they implemented that, since I thought that you couldn't select paths in this way using a file explorer, but maybe its possible. Will have to look. Perhaps they created a custom component, have you taken a look?

i wish i knew. his gui py here : https://github.com/bmaltais/kohya_ss/blob/master/kohya_gui.py

actual code : https://github.com/bmaltais/kohya_ss/blob/master/kohya_gui/dreambooth_gui.py

more actual code : https://github.com/bmaltais/kohya_ss/blob/master/kohya_gui/common_gui.py

above file has

try:
    from tkinter import filedialog, Tk
except ImportError:
    pass
from easygui import msgbox, ynbox
from typing import Optional
from .custom_logging import setup_logging

it works really amazing

from gradio.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.