You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-----------------That's the error caused by the code-----------------
ValueError Traceback (most recent call last) in <cell line: 263>()
261
262 clientURL = "https://7c320ebe81d94f95f5.gradio.live/"
--> 263 FooocusGradio(clientURL)
264
7 frames in FooocusGradio(clientURL)
8 def FooocusGradio(clientURL):
9 client = Client(clientURL)
---> 10 result = client.predict(
11 True, # bool in 'Generate Image Grid for Each Batch' Checkbox component
12 "", # str in 'parameter_12' Textbox component
/usr/local/lib/python3.10/dist-packages/gradio_client/client.py in predict(self, api_name, fn_index, *args)
289 "Cannot call predict on this function as it may run forever. Use submit instead."
290 )
--> 291 return self.submit(*args, api_name=api_name, fn_index=fn_index).result()
292
293 def submit(
/usr/lib/python3.10/concurrent/futures/_base.py in __get_result(self)
401 if self._exception:
402 try:
--> 403 raise self._exception
404 finally:
405 # Break a reference cycle with the exception in self._exception
/usr/local/lib/python3.10/dist-packages/gradio_client/client.py in _inner(*data)
791 if self.client.serialize:
792 data = self.serialize(*data)
--> 793 predictions = _predict(*data)
794 predictions = self.process_predictions(*predictions)
795 # Append final output only if not already present
/usr/local/lib/python3.10/dist-packages/gradio_client/client.py in _predict(*data)
822 result = utils.synchronize_async(self._ws_fn, data, hash_data, helper)
823 if "error" in result:
--> 824 raise ValueError(result["error"])
825 else:
826 response = requests.post(
ValueError: None
Please let me know how to fix the error.
I'm glad if you show the code you write to use gradio_client.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I would like to ask about how to use Fooocus via gradio_client
I tried to use it, that cause error and I'm not sure where causes the error.
------------The code I tried --------------------
!pip install gradio==3.41.2
from gradio_client import Client
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
def FooocusGradio(clientURL):
client = Client(clientURL, serialize=False)
result = client.predict(
True, # bool in 'Generate Image Grid for Each Batch' Checkbox component
"", # str in 'parameter_12' Textbox component
"", # str in 'Negative Prompt' Textbox component
["Fooocus V2"], # List[str] in 'Selected Styles' Checkboxgroup component
"Quality", # str in 'Performance' Radio component
"704×1408", # str in 'Aspect Ratios' Radio component
1, # int | float (numeric value between 1 and 32)
#in 'Image Number' Slider component
"png", # str in 'Output Format' Radio component
"", # str in 'Seed' Textbox component
True, # bool in 'Read wildcards in order' Checkbox component
0, # int | float (numeric value between 0.0 and 30.0)
#in 'Image Sharpness' Slider component
1, # int | float (numeric value between 1.0 and 30.0)
#in 'Guidance Scale' Slider component
"juggernautXL_v8Rundiffusion.safetensors", # str (Option from: ['juggernautXL_v8Rundiffusion.safetensors'])
#in 'Base Model (SDXL only)' Dropdown component
"None", # str (Option from: ['None', 'juggernautXL_v8Rundiffusion.safetensors'])
#in 'Refiner (SDXL or SD 1.5)' Dropdown component
0.1, # int | float (numeric value between 0.1 and 1.0)
#in 'Refiner Switch At' Slider component
True, # bool in 'Enable' Checkbox component
"None", # str (Option from: ['None', 'sd_xl_offset_example-lora_1.0.safetensors'])
#in 'LoRA 1' Dropdown component
-2, # int | float (numeric value between -2 and 2)
#in 'Weight' Slider component
True, # bool in 'Enable' Checkbox component
"None", # str (Option from: ['None', 'sd_xl_offset_example-lora_1.0.safetensors'])
#in 'LoRA 2' Dropdown component
-2, # int | float (numeric value between -2 and 2)
#in 'Weight' Slider component
True, # bool in 'Enable' Checkbox component
"None", # str (Option from: ['None', 'sd_xl_offset_example-lora_1.0.safetensors'])
#in 'LoRA 3' Dropdown component
-2, # int | float (numeric value between -2 and 2)
#in 'Weight' Slider component
True, # bool in 'Enable' Checkbox component
"None", # str (Option from: ['None', 'sd_xl_offset_example-lora_1.0.safetensors'])
#in 'LoRA 4' Dropdown component
-2, # int | float (numeric value between -2 and 2)
#in 'Weight' Slider component
True, # bool in 'Enable' Checkbox component
"None", # str (Option from: ['None', 'sd_xl_offset_example-lora_1.0.safetensors'])
#in 'LoRA 5' Dropdown component
-2, # int | float (numeric value between -2 and 2)
#in 'Weight' Slider component
True, # bool in 'Input Image' Checkbox component
"", # str in 'parameter_212' Textbox component
"Disabled", # str in 'Upscale or Variation:' Radio component
"https://raw.githubusercontent.com/gradio-app/gradio/main/test/test_files/bus.png", # str (filepath or URL to image)
#in 'Image' Image component
["Left"], # List[str] in 'Outpaint Direction' Checkboxgroup component
"https://raw.githubusercontent.com/gradio-app/gradio/main/test/test_files/bus.png", # str (filepath or URL to image)
#in 'Image' Image component
"", # str in 'Inpaint Additional Prompt' Textbox component
"https://raw.githubusercontent.com/gradio-app/gradio/main/test/test_files/bus.png", # str (filepath or URL to image)
#in 'Mask Upload' Image component
True, # bool in 'Disable Preview' Checkbox component
True, # bool in 'Disable Intermediate Results' Checkbox component
True, # bool in 'Disable seed increment' Checkbox component
True, # bool in 'Black Out NSFW' Checkbox component
0.1, # int | float (numeric value between 0.1 and 3.0)
#in 'Positive ADM Guidance Scaler' Slider component
0.1, # int | float (numeric value between 0.1 and 3.0)
#in 'Negative ADM Guidance Scaler' Slider component
0, # int | float (numeric value between 0.0 and 1.0)
#in 'ADM Guidance End At Step' Slider component
1, # int | float (numeric value between 1.0 and 30.0)
#in 'CFG Mimicking from TSNR' Slider component
1, # int | float (numeric value between 1 and 12)
#in 'CLIP Skip' Slider component
"euler", # str (Option from: ['euler', 'euler_ancestral', 'heun', 'heunpp2', 'dpm_2', 'dpm_2_ancestral', 'lms', 'dpm_fast', 'dpm_adaptive', 'dpmpp_2s_ancestral', 'dpmpp_sde', 'dpmpp_sde_gpu', 'dpmpp_2m', 'dpmpp_2m_sde', 'dpmpp_2m_sde_gpu', 'dpmpp_3m_sde', 'dpmpp_3m_sde_gpu', 'ddpm', 'lcm', 'tcd', 'restart', 'ddim', 'uni_pc', 'uni_pc_bh2'])
#in 'Sampler' Dropdown component
"normal", # str (Option from: ['normal', 'karras', 'exponential', 'sgm_uniform', 'simple', 'ddim_uniform', 'lcm', 'turbo', 'align_your_steps', 'tcd', 'edm_playground_v2.5'])
#in 'Scheduler' Dropdown component
"Default (model)", # str (Option from: ['Default (model)'])
#in 'VAE' Dropdown component
-1, # int | float (numeric value between -1 and 200)
#in 'Forced Overwrite of Sampling Step' Slider component
-1, # int | float (numeric value between -1 and 200)
#in 'Forced Overwrite of Refiner Switch Step' Slider component
-1, # int | float (numeric value between -1 and 2048)
#in 'Forced Overwrite of Generating Width' Slider component
-1, # int | float (numeric value between -1 and 2048)
#in 'Forced Overwrite of Generating Height' Slider component
-1, # int | float (numeric value between -1 and 1.0)
#in 'Forced Overwrite of Denoising Strength of "Vary"' Slider component
-1, # int | float (numeric value between -1 and 1.0)
#in 'Forced Overwrite of Denoising Strength of "Upscale"' Slider component
True, # bool in 'Mixing Image Prompt and Vary/Upscale' Checkbox component
True, # bool in 'Mixing Image Prompt and Inpaint' Checkbox component
True, # bool in 'Debug Preprocessors' Checkbox component
True, # bool in 'Skip Preprocessors' Checkbox component
1, # int | float (numeric value between 1 and 255)
#in 'Canny Low Threshold' Slider component
1, # int | float (numeric value between 1 and 255)
#in 'Canny High Threshold' Slider component
"joint", # str (Option from: ['joint', 'separate', 'vae'])
#in 'Refiner swap method' Dropdown component
0, # int | float (numeric value between 0.0 and 1.0)
#in 'Softness of ControlNet' Slider component
True, # bool in 'Enabled' Checkbox component
0, # int | float (numeric value between 0 and 2)
#in 'B1' Slider component
0, # int | float (numeric value between 0 and 2)
#in 'B2' Slider component
0, # int | float (numeric value between 0 and 4)
#in 'S1' Slider component
0, # int | float (numeric value between 0 and 4)
#in 'S2' Slider component
True, # bool in 'Debug Inpaint Preprocessing' Checkbox component
True, # bool in 'Disable initial latent in inpaint' Checkbox component
"None", # str (Option from: ['None', 'v1', 'v2.5', 'v2.6'])
#in 'Inpaint Engine' Dropdown component
0, # int | float (numeric value between 0.0 and 1.0)
#in 'Inpaint Denoising Strength' Slider component
0, # int | float (numeric value between 0.0 and 1.0)
#in 'Inpaint Respective Field' Slider component
True, # bool in 'Enable Advanced Masking Features' Checkbox component
True, # bool in 'Invert Mask When Generating' Checkbox component
-64, # int | float (numeric value between -64 and 64)
#in 'Mask Erode or Dilate' Slider component
True, # bool in 'Save only final enhanced image' Checkbox component
True, # bool in 'Save Metadata to Images' Checkbox component
"fooocus", # str in 'Metadata Scheme' Radio component
"https://raw.githubusercontent.com/gradio-app/gradio/main/test/test_files/bus.png", # str (filepath or URL to image)
#in 'Image' Image component
0, # int | float (numeric value between 0.0 and 1.0)
#in 'Stop At' Slider component
0, # int | float (numeric value between 0.0 and 2.0)
#in 'Weight' Slider component
"ImagePrompt", # str in 'Type' Radio component
"https://raw.githubusercontent.com/gradio-app/gradio/main/test/test_files/bus.png", # str (filepath or URL to image)
#in 'Image' Image component
0, # int | float (numeric value between 0.0 and 1.0)
#in 'Stop At' Slider component
0, # int | float (numeric value between 0.0 and 2.0)
#in 'Weight' Slider component
"ImagePrompt", # str in 'Type' Radio component
"https://raw.githubusercontent.com/gradio-app/gradio/main/test/test_files/bus.png", # str (filepath or URL to image)
#in 'Image' Image component
0, # int | float (numeric value between 0.0 and 1.0)
#in 'Stop At' Slider component
0, # int | float (numeric value between 0.0 and 2.0)
#in 'Weight' Slider component
"ImagePrompt", # str in 'Type' Radio component
"https://raw.githubusercontent.com/gradio-app/gradio/main/test/test_files/bus.png", # str (filepath or URL to image)
#in 'Image' Image component
0, # int | float (numeric value between 0.0 and 1.0)
#in 'Stop At' Slider component
0, # int | float (numeric value between 0.0 and 2.0)
#in 'Weight' Slider component
"ImagePrompt", # str in 'Type' Radio component
True, # bool in 'Debug GroundingDINO' Checkbox component
-64, # int | float (numeric value between -64 and 64)
#in 'GroundingDINO Box Erode or Dilate' Slider component
True, # bool in 'Debug Enhance Masks' Checkbox component
"https://raw.githubusercontent.com/gradio-app/gradio/main/test/test_files/bus.png", # str (filepath or URL to image)
#in 'Use with Enhance, skips image generation' Image component
True, # bool in 'Enhance' Checkbox component
"Disabled", # str in 'Upscale or Variation:' Radio component
"Before First Enhancement", # str in 'Order of Processing' Radio component
"Original Prompts", # str in 'Prompt' Radio component
True, # bool in 'Enable' Checkbox component
"", # str in 'Detection prompt' Textbox component
"", # str in 'Enhancement positive prompt' Textbox component
"", # str in 'Enhancement negative prompt' Textbox component
"u2net", # str (Option from: ['u2net', 'u2netp', 'u2net_human_seg', 'u2net_cloth_seg', 'silueta', 'isnet-general-use', 'isnet-anime', 'sam'])
#in 'Mask generation model' Dropdown component
"full", # str (Option from: ['full', 'upper', 'lower'])
#in 'Cloth category' Dropdown component
"vit_b", # str (Option from: ['vit_b', 'vit_l', 'vit_h'])
#in 'SAM model' Dropdown component
0, # int | float (numeric value between 0.0 and 1.0)
#in 'Text Threshold' Slider component
0, # int | float (numeric value between 0.0 and 1.0)
#in 'Box Threshold' Slider component
0, # int | float (numeric value between 0 and 10)
#in 'Maximum number of detections' Slider component
True, # bool in 'Disable initial latent in inpaint' Checkbox component
"None", # str (Option from: ['None', 'v1', 'v2.5', 'v2.6'])
#in 'Inpaint Engine' Dropdown component
0, # int | float (numeric value between 0.0 and 1.0)
#in 'Inpaint Denoising Strength' Slider component
0, # int | float (numeric value between 0.0 and 1.0)
#in 'Inpaint Respective Field' Slider component
-64, # int | float (numeric value between -64 and 64)
#in 'Mask Erode or Dilate' Slider component
True, # bool in 'Invert Mask' Checkbox component
True, # bool in 'Enable' Checkbox component
"", # str in 'Detection prompt' Textbox component
"", # str in 'Enhancement positive prompt' Textbox component
"", # str in 'Enhancement negative prompt' Textbox component
"u2net", # str (Option from: ['u2net', 'u2netp', 'u2net_human_seg', 'u2net_cloth_seg', 'silueta', 'isnet-general-use', 'isnet-anime', 'sam'])
#in 'Mask generation model' Dropdown component
"full", # str (Option from: ['full', 'upper', 'lower'])
#in 'Cloth category' Dropdown component
"vit_b", # str (Option from: ['vit_b', 'vit_l', 'vit_h'])
#in 'SAM model' Dropdown component
0, # int | float (numeric value between 0.0 and 1.0)
#in 'Text Threshold' Slider component
0, # int | float (numeric value between 0.0 and 1.0)
#in 'Box Threshold' Slider component
0, # int | float (numeric value between 0 and 10)
#in 'Maximum number of detections' Slider component
True, # bool in 'Disable initial latent in inpaint' Checkbox component
"None", # str (Option from: ['None', 'v1', 'v2.5', 'v2.6'])
#in 'Inpaint Engine' Dropdown component
0, # int | float (numeric value between 0.0 and 1.0)
#in 'Inpaint Denoising Strength' Slider component
0, # int | float (numeric value between 0.0 and 1.0)
#in 'Inpaint Respective Field' Slider component
-64, # int | float (numeric value between -64 and 64)
#in 'Mask Erode or Dilate' Slider component
True, # bool in 'Invert Mask' Checkbox component
True, # bool in 'Enable' Checkbox component
"", # str in 'Detection prompt' Textbox component
"", # str in 'Enhancement positive prompt' Textbox component
"", # str in 'Enhancement negative prompt' Textbox component
"u2net", # str (Option from: ['u2net', 'u2netp', 'u2net_human_seg', 'u2net_cloth_seg', 'silueta', 'isnet-general-use', 'isnet-anime', 'sam'])
#in 'Mask generation model' Dropdown component
"full", # str (Option from: ['full', 'upper', 'lower'])
#in 'Cloth category' Dropdown component
"vit_b", # str (Option from: ['vit_b', 'vit_l', 'vit_h'])
#in 'SAM model' Dropdown component
0, # int | float (numeric value between 0.0 and 1.0)
#in 'Text Threshold' Slider component
0, # int | float (numeric value between 0.0 and 1.0)
#in 'Box Threshold' Slider component
0, # int | float (numeric value between 0 and 10)
#in 'Maximum number of detections' Slider component
True, # bool in 'Disable initial latent in inpaint' Checkbox component
"None", # str (Option from: ['None', 'v1', 'v2.5', 'v2.6'])
#in 'Inpaint Engine' Dropdown component
0, # int | float (numeric value between 0.0 and 1.0)
#in 'Inpaint Denoising Strength' Slider component
0, # int | float (numeric value between 0.0 and 1.0)
#in 'Inpaint Respective Field' Slider component
-64, # int | float (numeric value between -64 and 64)
#in 'Mask Erode or Dilate' Slider component
True, # bool in 'Invert Mask' Checkbox component
fn_index=67
)
result = client.predict(
fn_index=68
)
img = mpimg.imread(result[2])
plt.imshow(img)
plt.show()
clientURL = "https://7c320ebe81d94f95f5.gradio.live"
FooocusGradio(clientURL)
-----------------That's the error caused by the code-----------------
ValueError Traceback (most recent call last)
in <cell line: 263>()
261
262 clientURL = "https://7c320ebe81d94f95f5.gradio.live/"
--> 263 FooocusGradio(clientURL)
264
7 frames
in FooocusGradio(clientURL)
8 def FooocusGradio(clientURL):
9 client = Client(clientURL)
---> 10 result = client.predict(
11 True, # bool in 'Generate Image Grid for Each Batch' Checkbox component
12 "", # str in 'parameter_12' Textbox component
/usr/local/lib/python3.10/dist-packages/gradio_client/client.py in predict(self, api_name, fn_index, *args)
289 "Cannot call predict on this function as it may run forever. Use submit instead."
290 )
--> 291 return self.submit(*args, api_name=api_name, fn_index=fn_index).result()
292
293 def submit(
/usr/local/lib/python3.10/dist-packages/gradio_client/client.py in result(self, timeout)
1118 >> 9
1119 """
-> 1120 return super().result(timeout=timeout)
1121
1122 def outputs(self) -> list[tuple | Any]:
/usr/lib/python3.10/concurrent/futures/_base.py in result(self, timeout)
456 raise CancelledError()
457 elif self._state == FINISHED:
--> 458 return self.__get_result()
459 else:
460 raise TimeoutError()
/usr/lib/python3.10/concurrent/futures/_base.py in __get_result(self)
401 if self._exception:
402 try:
--> 403 raise self._exception
404 finally:
405 # Break a reference cycle with the exception in self._exception
/usr/lib/python3.10/concurrent/futures/thread.py in run(self)
56
57 try:
---> 58 result = self.fn(*self.args, **self.kwargs)
59 except BaseException as exc:
60 self.future.set_exception(exc)
/usr/local/lib/python3.10/dist-packages/gradio_client/client.py in _inner(*data)
791 if self.client.serialize:
792 data = self.serialize(*data)
--> 793 predictions = _predict(*data)
794 predictions = self.process_predictions(*predictions)
795 # Append final output only if not already present
/usr/local/lib/python3.10/dist-packages/gradio_client/client.py in _predict(*data)
822 result = utils.synchronize_async(self._ws_fn, data, hash_data, helper)
823 if "error" in result:
--> 824 raise ValueError(result["error"])
825 else:
826 response = requests.post(
ValueError: None
Please let me know how to fix the error.
I'm glad if you show the code you write to use gradio_client.
Thank you,
Sincerely.
Beta Was this translation helpful? Give feedback.
All reactions