Perhaps people here already followed it too.
I’ve installed Python 3.9.5 and work with the standard version of Touch : 2022.33910.
I used Anaconda prompt to pip install stability sdk.
I think (but not sure) the problem is that Touchdesigner and python mismatch.
Here the error I get :
Traceback (most recent call last):
File “/project1/base_stable_diffusion/parexec1”, line 23, in onPulse
td.tdError: File “/project1/base_stable_diffusion/text_apiCall”, line 16
File “C:\Program Files\Derivative\TouchDesigner\bin\lib\site-packages\stability_sdk\client.py”, line 137, in init
raise ValueError(f"key is required for {host}")
ValueError: key is required for grpc.stability.ai:443
Results of run operation resulted in exception.
What is client.py and why he give back error ?
Please if someone can help. It could be fantastic.
BUT on the tutorial the part you referenced doesn’t exist.
Here how does it look like in touch TextDAT :
" #Paste your API Key below
os.environ[‘STABILITY_KEY’] = op(‘text_apiKey’).text
#Set up our connection to the API.
stability_api = client.StabilityInference(
key=os.environ[‘STABILITY_KEY’], # API Key reference.
verbose=True, # Print debug messages.
engine=“stable-diffusion-xl-1024-v1-0”, # Set the engine to use for generation.
)
"
In the part # Paste your API Key below :
I don’t understand the fonction of op(‘text_apiKey’).text because on touch the textDAT named “text_apiKey” remain empty. (really followed the tutorial carefully)
In the part # Set up our connection to the API.
The guy in tutorial say to change nothing.
Now, thanks to the link you shared me I’ve set a stability-sdk folder. The python -m stability_sdk generate “A stunning house” command is working well but I don’t think it match with the purpose on tutorial.
On python39, my folder is named stability_sdk.
On the link you shared me the folder generated is named stability-sdk.
I’ve linked the content of both.
If I replace stability_sdk folder by stability-sdk folder on my python site-package path, Touchdesigner give me back another error :
"
Traceback (most recent call last):
File “/project1/base_stable_diffusion/parexec1”, line 23, in onPulse
td.tdError: File “/project1/base_stable_diffusion/text_apiCall”, line 5
ImportError: cannot import name ‘client’ from ‘stability_sdk’ (unknown location)
"
Other options FYI
If python is not your thing, this implementation is basically plug and play, very easy to get going.
If you want to try a full featured Stable Diffusion component that run local on your computer, but requires python and some setup, I recommend this. I found the steps very easy to follow, at least moreso than the Stability.ai documentation.
I pasted my API key into the text_apiKey DAT and got a similar error:
File “/project1/base_stable_diffusion/parexec1”, line 23, in onPulse
AttributeError: ‘NoneType’ object has no attribute ‘run’
(File “/project1/base_stable_diffusion/parexec1”)
I did have a typo in DAT and after fixing it, i had another ModuleNotFound Error:no module named stability_sdk. But when I run pip list, I got stability-sdk 0.8.4, meaning I had it installed right?