Perfect

#3
by Sacso - opened

Amazing results, I'm very pleased, sometimes of course after 10 results it gives an error.

I would also like to know if it is possible to create this work model like yours, is it difficult? Is programming knowledge required?

@Sacso Hello, It requires a little programming knowledge but not too much. You can see all the code for this in the app.py file. If you want to learn more about how to make something like this, I would look up a tutorial on how to use "Stable Diffusion".

@Sacso Hello, It requires a little programming knowledge but not too much. You can see all the code for this in the app.py file. If you want to learn more about how to make something like this, I would look up a tutorial on how to use "Stable Diffusion".

Thank you for your answer, I am very grateful to you, I will definitely read what you recommended, I hope that I will get something like yours. Although in programming I'm still the most beginner, rather even zero :) But there is definitely a desire, seeing the results that your creation gives!

Curranj hello, could you recommend tutorials from which it would be more accessible to create the same model here on the platform? I would be very grateful to you.

Sacso changed discussion status to closed
Sacso changed discussion status to open

Curranj hello, can I create a copy of your code like yours? And what should I have installed for this?

Yes, copy it! All you need to change is adding your own stable diffusion api key from https://beta.dreamstudio.ai/membership . You can see the only requirement in the requirements.txt file.

That is, I need to create my space here on the site, paste your code from yours "app.py@, and then paste the key itself, but where to install it?

And another question, it stopped generating pictures for you, and now it gives out a picture, is this due to the limit on pictures?

I created a space, copied your code, but apparently I'm doing something wrong.

If you look where it says key=os.environ["Secret"], that is where it is reading the api key from. you need to create a secret named “Secret” with your dreamstudio api key, which lets the app read the key without anyone else seeing it

And the space itself, I correctly copied from your code, it gives me an error on line 5

That’s a weird error, I would add Ipython or any other possible dependencies to the requirements.txt file and see if it fixes it

I probably tormented you with questions, but apparently with my zero knowledge in programming, just copying the code, it was not possible to create a copy of your space.

Will you restore your space?

If you have Google collab, here is simple way to make the images if you follow the steps: https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers/stable_diffusion.ipynb

Your result using flowers is the most ideal for me, I just thought, in order not to distract you, to do something similar to myself, like you have, so that you can run it on your computer.

I’m already trying this option, but I really like your flowers :)

Haha I appreciate it! You can also make it yourself if you put your prompt in this text “Beautiful Portait of a {prompt} made out of flowers 💐 🌺 🌸 , artstation winner by Victo Ngai, Kilian Eng, vibrant colors, winning-award masterpiece, aesthetic octane render, 8K HD” and make the height=706. :)

I would love to do this, but as you can see, my space does not want to work with me, as well as my knowledge of programming is zero :) Can you by any chance set up my space so that it works like you do? I understand that the request is great, but still :)

I’d be happy to, do you have Google colab? Are you looking for the simple interface? I could send you over a pretty simple Google collab that will create you a web link for the interface

Have a google account, yes interface like you have here

here is a link to one, I made it as simple as I could (takes some time to set up): https://colab.research.google.com/drive/1o8S0YGkcG16H9pRYt04233qwtOLkr39l?usp=sharing

Thank you very much and thank you! It works! I understand that it will work and will not give errors after a while, like here on huggingface? In any case, I am very grateful to you for the time you spent for me, I know that it is valuable for every person! Thanks for your knowledge!

And will this link be permanent, or will it disappear over time? And will it be possible to use simplegradio.ipynb itself in the collab or is it also for a certain time? And will there be errors, and is it possible to restart them yourself?

I think it should be permanent, you can also copy the code and run it anywhere else, and if there are errors you should be able to restart it

Thanks again for your patience and work, I appreciate and respect what you have done!

Curranj, good day to you, everything works, though only 72 hours, you have to restart your colab every time that you created to get a new link. I tried to paste the code that you created in this notepad into space "huggingface", but unfortunately it does not want to work there. I will then use this method that you created, restarting the colab each time. Thank you again for your help!

Good day Curranj, I’m returning to your code again, trying to run it on my own, and I can’t understand, should I have something installed on my computer in order for the space to start?

And another question, can I clone your space with some command so that it works for me?

My space https://huggingface.co/spaces/Sacso/FlowerDi that I created, copied everything exactly like yours, but alas, I apparently do something wrong.

If you want to create a space, be sure to add a “Secret” under the setting tab for your space to connect to the API. It will eventually be possible to run this for free on Huggingface, but it costs a couple cents an image right now using the Stable Diffusion API. You can create an API code at https://beta.dreamstudio.ai/membership . In my code, when it says
“key=os.environ["Secret"]”, it is calling a hidden variable instead of the API key itself so that people can’t steal the API key.

I created an API key like you have called "Secret" by specifying the key itself in the settings, taking it right there on the site and generating it, but alas. Error.

Traceback (most recent call last):
File "app.py", line 5, in
from IPython.display import display
ModuleNotFoundError: No module named 'IPython'

As I said, your solution with flowers is just perfect!
cute hedgehog.png

Weird, Maybe try putting ipython in the requirements.txt? Not sure why it’s not working!

I commend you on your perseverance! Setting up my first gradio page was difficult for me and took a bunch of troubleshooting, Keep trying though!!! Let me know any difficulties you run into

You can just delete the ipython line btw, it isn’t actually being used. I took it out of this space and it works the same

Curranj, the code worked, the space started, but unfortunately when you click on run , it gives an error, do you have any ideas what could cause the error?

Did you purchase any picture credits from the api

No, I just created a space for now, and it started, as I understand it, because of this, image processing does not start? Where can I buy to make it work? I just thought that the correct code is enough to start processing the image.

If you want to run it locally it is free, but that takes a dedicated GPU. To get around that, I’m using the API here: https://beta.dreamstudio.ai/membership . If you purchase credits and create a “Secret” key it should work

It turns out that in order to generate for free, I must have a good video card, if not, then I can use the https://beta.dreamstudio.ai/membership service and replenish my account there to use their API key for generation, right?

And another question, now you have created your own space, use the API https://beta.dreamstudio.ai/membership, do you replenish your account so that pictures are generated for you? That is, if your account runs out of money and the limit is reached, the pictures will not be generated until you replenish it? It just turns out that anyone is using your space to generate spending your credits, am I right?

Yep, I just like showing pretty pictures :), I’ll have to turn it off soon though

Yep, I just like showing pretty pictures :), I’ll have to turn it off soon though

I understand the shutdown will be for purely financial reasons?
However, I thank you for your code and your kindness and hard work!

And another question, will it be difficult to create your code offline without the help of Hugging Face on your computer (the ability to save your code and modify it and add it on a desktop computer is important)

If you have a GPU you can run it on your own computer, otherwise you can reference this Google colab I made to run it easily on any device: https://colab.research.google.com/drive/1o8S0YGkcG16H9pRYt04233qwtOLkr39l?usp=sharing

Grateful for your support and good code, it's nice that you find time for answers, I really appreciate it! Thanks for the links, you are a good teacher ;)

Aaah, it worked!!! Curranj, you are just a magician, how invaluable is your work and your code! Until I had so much information received in this thread! Huge thanks to you!

Grateful for your support and good code, it's nice that you find time for answers, I really appreciate it! Thanks for the links, you are a good teacher ;)

I completely agree, very kind and good teacher!

I commend you on your perseverance! Setting up my first gradio page was difficult for me and took a bunch of troubleshooting, Keep trying though!!! Let me know any difficulties you run into

As already written below, you are an excellent teacher, and your perseverance in itself is a good example for such beginners in small knowledge in coding to get good!

Curranj, hello, can you tell me if it is possible to insert a line into your code that I would allow to display "Potential NSFW content was detected in one or more images. A black image will be returned instead. Try again with a different prompt and/or seed" I'm just not always sure that my harmless text can generate something locked

Curranj, hello, how to change in your code so that the width is greater than 512, for example 832 ?

Curranj, hello, can you tell me if it is possible to insert a line into your code that I would allow to display "Potential NSFW content was detected in one or more images. A black image will be returned instead. Try again with a different prompt and/or seed" I'm just not always sure that my harmless text can generate something locked

Yes, by the way, it would be nice if it were possible to implement this in your code.

Sign up or log in to comment