I am using Visual Studio Code with Pylance I am trying with the following program, the local host is being created, the gradio function also generates a link which when you physically enter in the browser opens the gradio program properly but is there any way that the gradio program can open in a new browser tab/window on clicking on the button.
import gradio as gr
import webbrowser
import tkinter as tk
import threading
# Define the Gradio program
def greet(name):
return "Hello, " + name + "!"
iface = gr.Interface(greet, "text", "text", title="Greeting App", description="Enter your name to get a greeting")
# Define the function that launches the Gradio program in a browser
def launch_gradio():
def run_gradio():
iface.launch()
thread = threading.Thread(target=run_gradio)
thread.start()
print("Click")
# Create a Tkinter window with a button
window = tk.Tk()
window.title("Gradio Launcher")
button = tk.Button(window, text="Launch Gradio", command=launch_gradio)
button.pack()
# Start the Tkinter event loop
window.mainloop()
I also tried 'webbrowser' module to open the link but it opens file explorer of the file that contains the program