Comments (9)
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.
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.
@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.
For future reference, this PR contains the relevant discussion: #6689
from gradio.
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
from gradio.
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.
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
step 2 - go to folder
step 3 - click select folder
step 4 - folder copy pasted into input field
from gradio.
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.
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)
- `.svg` files cannot be used as avatar_images HOT 5
- <!-- tag=changesets_gradio --> HOT 1
- A syntax error occurred in the viewer console HOT 2
- The autoplay parameter for audio or video does not take effect in Chatbot
- Refresh method for FileExplorer component HOT 1
- Audio component to have events for "loading of audio file complete", especially when loading large audio files HOT 1
- Ensure Button icon looks good when no text is specified HOT 3
- Disable telemetry HOT 2
- Audio streaming not working for large files HOT 3
- ImageEditor's toolbox not show complete HOT 2
- Choice updates to dropdowns are forgotten when component is re-renderred with a key HOT 1
- ValueError when using gradio components in Chatbot messages and streaming response HOT 1
- Repository too heavy HOT 1
- Warning caused by empty 'for' attribute in BlockLabel (Firefox only)
- ChatInterface type='messages', API still uses tuples format HOT 1
- Hangs at loading shards then get a OOM error. HOT 1
- Certain static files are requested over http (instead of https) behind kubernetes proxy HOT 1
- Markdown and HTML components don't have scale or max_width args HOT 2
- Drag & Drop specific `file_types` is broken for MultimodalTextbox
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gradio.