We can use GPT to generate nicegui code and create an application for generating UI through dialogue. #1371
Replies: 9 comments 6 replies
-
i dont think gpt has knowledge of nicegui as its last knowledge update was in 2021. |
Beta Was this translation helpful? Give feedback.
-
Also the ChatGPT code interpreter can not install libs right now:
As discussed some time ago on Discord, we need to train our own LLM (huge effort, i guess), write a ChatGPT Plugin which provides NiceGUI knowledge through a database (still a lot of effort) or create a prompt text which can be copy and pasted into ChatGPT so it knows about the basic concepts (manageable, but may not have the highest quality). |
Beta Was this translation helpful? Give feedback.
-
I started such a prompt in https://github.com/zauberzeug/nicegui/wiki#chatgpt. Please try it and help to improve it. |
Beta Was this translation helpful? Give feedback.
-
One day being able to achieve text -> UI and support some interactive commands would be really cool. |
Beta Was this translation helpful? Give feedback.
-
There are ways to embedd Github Repos into Chatgpt. I dont know how well this works, but there are frameworks, Github plugins and other ways out there. |
Beta Was this translation helpful? Give feedback.
-
There is also an interesting paper about the benefits of providing the documentation of a tool to LLMs: https://twitter.com/_akhaliq/status/1686569710001758208?s=20 |
Beta Was this translation helpful? Give feedback.
-
I've played around a bit with ChatGPT Code Interpreter where I uploaded the repo as a zip and the result is pretty impressive. Chatgpt really searches the repo, understands the content and writes the code. from nicegui import ui
from yt_dlp import YoutubeDL
import asyncio
from concurrent.futures import ThreadPoolExecutor
# Updated progress hook to strip ANSI escape codes and other non-numeric characters
def updated_progress_hook(d):
if d['status'] == 'downloading' and d.get('total_bytes'):
progress_value = d['downloaded_bytes'] / d['total_bytes']
print(progress_value)
progress_bar.value = progress_value
progress_label.text = f"{progress_value * 100:.2f}%"
async def download_video_async():
# Get the YouTube URL from the input field
youtube_url = url_input.value
# Notify the user that the download has started
ui.notify('Starting download...')
# Use ThreadPoolExecutor to run the synchronous youtube-dlp function in a separate thread
with ThreadPoolExecutor() as executor:
await asyncio.get_event_loop().run_in_executor(executor, download_video, youtube_url)
# Notify the user once the download is complete
ui.notify('Video downloaded successfully!')
def download_video(youtube_url):
# Configure youtube-dlp options
ydl_opts = {
'format': 'best',
'outtmpl': './videos/%(title)s.%(ext)s', # Save videos in a "videos" directory
'progress_hooks': [updated_progress_hook], # Use the updated progress hook
}
# Download the video
with YoutubeDL(ydl_opts) as ydl:
ydl.download([youtube_url])
# Create the NiceGUI app
url_input = ui.input(placeholder="Enter YouTube URL here")
download_button = ui.button("Download", on_click=download_video_async).tailwind('bg-gradient-to-r', 'from-purple-500', 'to-green-500', 'text-white')
progress_bar = ui.linear_progress() # Add the progress bar
progress_label = ui.label("")
with ui.header().classes('items-center justify-between text-white').style('background-color: #3874c8'):
ui.label('Downloader')
ui.run() I didn't write a single line of code my self, though I am not sure if the async part is the properly written. It works tough. |
Beta Was this translation helpful? Give feedback.
-
P.S. |
Beta Was this translation helpful? Give feedback.
-
GPT-4o Knows NiceGUI. |
Beta Was this translation helpful? Give feedback.
-
The following is my idea:
Application side:
Create a button
, converts the input into nicegui code using llm, modify main.py, and reload the GUI service.Beta Was this translation helpful? Give feedback.
All reactions