Skip to content

Gradio 4 Port (main branch)#295

Open
Panchovix wants to merge 392 commits into
mainfrom
gradio4_main
Open

Gradio 4 Port (main branch)#295
Panchovix wants to merge 392 commits into
mainfrom
gradio4_main

Conversation

@Panchovix
Copy link
Copy Markdown
Owner

@Panchovix Panchovix commented Feb 28, 2025

See #291 for more details.

Adapted for main branch.


Description

Forge has Gradio 4. So I tried porting reForge to Gradio 4. The current status is that while WebUI launches without any errors on the python side, it gets stuck on a Dropdown.

Currently Fixing all the python side and interactivity. More or less done. Looking for bugs

Screenshots/videos:

Screenshots for postery and log of what works and doesn't work:

PNG Info

Slight issue where the width and height does not get sent properly. But prompts are properly sent.
image

Txt2Img Generation

image

Generated image with APG Extensions enabled and first proper waifu generated. :
00005-1009977012

Fixed imageviewer.js so the full screen image viewer also works too.

Img2Img Generation

Tested all 4. Seems to work
image

Deobfuscated forgeCanvas.js

Might be a hot take but anyway, deobfuscating the js so that people can work on it.

ForgeCanvas is "Touch compatible"

Your fingers on mobile are happier with a touch compatible forge canvas. While there are UI issues + (Zoom and Pans are not tested). You can comfortably doodle on the image.

Bugs & Missing Features

  • Width & Height doesn't get sent properly from png info / image inspector? Someone verify that's correct behaviour.
  • kohya_hrfix.py doesn't load. Fixed
  • ControlNet doesn't work due to new ForgeCanvas Fixed
  • ForgeCanvas does not work with mobile. Fixed
  • 4.40.0 is the latest version that this can be ported. Past that, InputAccordion is broken.
  • Sometimes this random stacktrace might appear. But doesn't affect functionality.
    File "stable-diffusion-webui-reForge-main\venv\lib\site-packages\gradio\queueing.py", line 536, in process_events
      response = await route_utils.call_process_api(
    File "stable-diffusion-webui-reForge-main\venv\lib\site-packages\gradio\route_utils.py", line 285, in call_process_api
      output = await app.get_blocks().process_api(
    File "stable-diffusion-webui-reForge-main\venv\lib\site-packages\gradio\blocks.py", line 1933, in process_api
      data = await self.postprocess_data(block_fn, result["prediction"], state)
    File "stable-diffusion-webui-reForge-main\venv\lib\site-packages\gradio\blocks.py", line 1742, in postprocess_data
      state[block._id] = block.__class__(**kwargs)
    File "stable-diffusion-webui-reForge-main\modules\gradio_extensons.py", line 145, in __repaired_init__
      original(self, *args, **fixed_kwargs)
    File "stable-diffusion-webui-reForge-main\venv\lib\site-packages\gradio\component_meta.py", line 163, in wrapper
      return fn(self, **kwargs)
    File "stable-diffusion-webui-reForge-main\venv\lib\site-packages\gradio\components\dropdown.py", line 86, in __init__
      [tuple(c) if isinstance(c, (tuple, list)) else (str(c), c) for c in choices]
    TypeError: 'function' object is not iterable
    

BugTesters

Python Stack Trace / Tracebacks are requested.

Extension Issues

  • sd-webui-additional-networks doesn't launch due to the following error. Since the extension is like 2 years old... Not in current scope to fix it anyway.

    *** Error executing callback ui_tabs_callback for G:\Stable difussion\stable-diffusion-webui-reForge\extensions\sd-webui-additional-networks\scripts\additional_networks.py
      Traceback (most recent call last):
        File "G:\Stable difussion\stable-diffusion-webui-reForge\modules\script_callbacks.py", line 283, in ui_tabs_callback
          res += c.callback() or []
                 ^^^^^^^^^^^^
        File "G:\Stable difussion\stable-diffusion-webui-reForge\extensions\sd-webui-additional-networks\scripts\additional_networks.py", line 290, in on_ui_tabs
          metadata_editor.setup_ui(addnet_paste_params)
        File "G:\Stable difussion\stable-diffusion-webui-reForge\extensions\sd-webui-additional-networks\scripts\metadata_editor.py", line 399, in setup_ui
          with gr.Row().style(equal_height=False):
               ^^^^^^^^^^^^^^
      AttributeError: 'Row' object has no attribute 'style'
    
  • stable-diffusion-webui-model-toolkit doesn't load with the following. Likely due to gradio 4 upgrade. But should be relatively easy to fix.

    *** Error executing callback ui_tabs_callback for G:\Stable difussion\stable-diffusion-webui-reForge\extensions\stable-diffusion-webui-model-toolkit\scripts\toolkit_gui.py
      Traceback (most recent call last):
        File "G:\Stable difussion\stable-diffusion-webui-reForge\modules\script_callbacks.py", line 283, in ui_tabs_callback
          res += c.callback() or []
                 ^^^^^^^^^^^^
        File "G:\Stable difussion\stable-diffusion-webui-reForge\extensions\stable-diffusion-webui-model-toolkit\scripts\toolkit_gui.py", line 677, in on_ui_tabs
          with gr.Blocks(css=css, analytics_enabled=False, variant="compact") as checkpoint_toolkit:
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "G:\Stable difussion\stable-diffusion-webui-reForge\venv\Lib\site-packages\gradio\blocks.py", line 1023, in __init__
          super().__init__(render=False, **kwargs)
        File "G:\Stable difussion\stable-diffusion-webui-reForge\modules\gradio_extensions.py", line 64, in BlockContext_init
          res = original_BlockContext_init(self, *args, **kwargs)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      TypeError: BlockContext.__init__() got an unexpected keyword argument 'variant'
    

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants