Spaces:
				
			
			
	
			
			
		Paused
		
	
	
	
			
			
	
	
	
	
		
		
		Paused
		
	Update app.py
Browse files
    	
        app.py
    CHANGED
    
    | @@ -4,17 +4,13 @@ import io | |
| 4 | 
             
            import random
         | 
| 5 | 
             
            import os
         | 
| 6 | 
             
            from PIL import Image
         | 
| 7 | 
            -
            from deep_translator import GoogleTranslator
         | 
| 8 |  | 
| 9 | 
             
            API_URL = "https://api-inference.huggingface.co/models/openskyml/dalle-3-xl"
         | 
| 10 | 
             
            API_TOKEN = os.getenv("HF_READ_TOKEN")
         | 
| 11 | 
             
            headers = {"Authorization": f"Bearer {API_TOKEN}"}
         | 
| 12 | 
             
            timeout = 100
         | 
| 13 | 
            -
            models_list = [" | 
| 14 | 
            -
             | 
| 15 | 
            -
            # PLEASE ❤ like ❤ this space. Please like me. I am 12 years old, one of my projects is: https://ai-hub.rf.gd . I live in Russia, I don't know English very well. Therefore, I apologize that there is only Russian here, but I think it will not be difficult to translate all this. (For example, using gpt)
         | 
| 16 | 
            -
             | 
| 17 | 
            -
            def query(prompt, model, is_negative=False, steps=30, cfg_scale=7, sampler="DPM++ 2M Karras", seed=-1, strength=0.7):
         | 
| 18 | 
             
                if prompt == "" or prompt == None:
         | 
| 19 | 
             
                    return None
         | 
| 20 |  | 
| @@ -22,14 +18,12 @@ def query(prompt, model, is_negative=False, steps=30, cfg_scale=7, sampler="DPM+ | |
| 22 | 
             
                API_TOKEN = random.choice([os.getenv("HF_READ_TOKEN"), os.getenv("HF_READ_TOKEN_2"), os.getenv("HF_READ_TOKEN_3"), os.getenv("HF_READ_TOKEN_4"), os.getenv("HF_READ_TOKEN_5")]) # it is free
         | 
| 23 | 
             
                headers = {"Authorization": f"Bearer {API_TOKEN}"}
         | 
| 24 | 
             
                key = random.randint(0, 999)
         | 
| 25 | 
            -
                
         | 
| 26 | 
            -
                prompt = GoogleTranslator(source='ru', target='en').translate(prompt)
         | 
| 27 | 
            -
                print(f'\033[1mГенерация {key} перевод:\033[0m {prompt}')
         | 
| 28 |  | 
| 29 | 
            -
                prompt = f"{prompt} | ultra detail, ultra elaboration, ultra quality, perfect."
         | 
| 30 | 
             
                print(f'\033[1mГенерация {key}:\033[0m {prompt}')
         | 
| 31 | 
            -
                if model == ' | 
| 32 | 
             
                    API_URL = "https://api-inference.huggingface.co/models/openskyml/dalle-3-xl"
         | 
|  | |
| 33 | 
             
                if model == 'Playground 2':
         | 
| 34 | 
             
                    API_URL = "https://api-inference.huggingface.co/models/playgroundai/playground-v2-1024px-aesthetic"
         | 
| 35 | 
             
                if model == 'Openjourney 4':
         | 
| @@ -40,7 +34,7 @@ def query(prompt, model, is_negative=False, steps=30, cfg_scale=7, sampler="DPM+ | |
| 40 | 
             
                    API_URL = "https://api-inference.huggingface.co/models/stablediffusionapi/lyrielv16"
         | 
| 41 | 
             
                if model == 'Animagine XL 2.0':
         | 
| 42 | 
             
                    API_URL = "https://api-inference.huggingface.co/models/Linaqruf/animagine-xl-2.0"
         | 
| 43 | 
            -
                    prompt = f"Anime. {prompt}"
         | 
| 44 | 
             
                if model == 'Counterfeit 2.5':
         | 
| 45 | 
             
                    API_URL = "https://api-inference.huggingface.co/models/gsdf/Counterfeit-V2.5"
         | 
| 46 | 
             
                if model == 'Realistic Vision 5.1':
         | 
| @@ -49,7 +43,7 @@ def query(prompt, model, is_negative=False, steps=30, cfg_scale=7, sampler="DPM+ | |
| 49 | 
             
                    API_URL = "https://api-inference.huggingface.co/models/digiplay/incursiosMemeDiffusion_v1.6"
         | 
| 50 | 
             
                if model == 'Anime Detailer XL':
         | 
| 51 | 
             
                    API_URL = "https://api-inference.huggingface.co/models/Linaqruf/anime-detailer-xl-lora"
         | 
| 52 | 
            -
                    prompt = f"Anime. {prompt}"
         | 
| 53 | 
             
                if model == 'epiCRealism':
         | 
| 54 | 
             
                    API_URL = "https://api-inference.huggingface.co/models/emilianJR/epiCRealism"
         | 
| 55 | 
             
                if model == 'PixelArt XL':
         | 
| @@ -62,9 +56,10 @@ def query(prompt, model, is_negative=False, steps=30, cfg_scale=7, sampler="DPM+ | |
| 62 | 
             
                    API_URL = "https://api-inference.huggingface.co/models/DoctorDiffusion/doctor-diffusion-s-controllable-vector-art-xl-lora"
         | 
| 63 | 
             
                if model == 'Disney':
         | 
| 64 | 
             
                    API_URL = "https://api-inference.huggingface.co/models/goofyai/disney_style_xl"
         | 
| 65 | 
            -
                    prompt = f"Disney style. {prompt}"
         | 
| 66 | 
            -
                if model == ' | 
| 67 | 
             
                    API_URL = "https://api-inference.huggingface.co/models/digiplay/CleanLinearMix_nsfw"
         | 
|  | |
| 68 | 
             
                if model == 'OrangeMixs':
         | 
| 69 | 
             
                    API_URL = "https://api-inference.huggingface.co/models/WarriorMama777/OrangeMixs"
         | 
| 70 |  | 
| @@ -101,13 +96,18 @@ footer {visibility: hidden !important;} | |
| 101 | 
             
            """
         | 
| 102 |  | 
| 103 | 
             
            with gr.Blocks(css=css) as dalle:
         | 
|  | |
| 104 | 
             
                with gr.Tab("Базовые настройки"):
         | 
| 105 | 
             
                    with gr.Row():
         | 
| 106 | 
             
                        with gr.Column(elem_id="prompt-container"):
         | 
| 107 | 
             
                            with gr.Row():
         | 
| 108 | 
            -
                                 | 
|  | |
|  | |
| 109 | 
             
                            with gr.Row():
         | 
| 110 | 
            -
                                 | 
|  | |
|  | |
| 111 |  | 
| 112 |  | 
| 113 |  | 
| @@ -125,15 +125,12 @@ with gr.Blocks(css=css) as dalle: | |
| 125 | 
             
                    with gr.Row():
         | 
| 126 | 
             
                        seed = gr.Slider(label="Seed", value=-1, minimum=-1, maximum=1000000000, step=1)
         | 
| 127 |  | 
| 128 | 
            -
                 | 
| 129 | 
            -
                    with gr.Row():
         | 
| 130 | 
            -
                        gr.Textbox(label="Шаблон prompt", value="{prompt} | ultra detail, ultra elaboration, ultra quality, perfect.")
         | 
| 131 | 
            -
             | 
| 132 | 
             
                with gr.Row():
         | 
| 133 | 
             
                    text_button = gr.Button("Генерация", variant='primary', elem_id="gen-button")
         | 
| 134 | 
             
                with gr.Row():
         | 
| 135 | 
             
                    image_output = gr.Image(type="pil", label="Изображение", elem_id="gallery")
         | 
| 136 |  | 
| 137 | 
            -
                text_button.click(query, inputs=[ | 
| 138 |  | 
| 139 | 
             
            dalle.launch(show_api=False, share=False)
         | 
|  | |
| 4 | 
             
            import random
         | 
| 5 | 
             
            import os
         | 
| 6 | 
             
            from PIL import Image
         | 
|  | |
| 7 |  | 
| 8 | 
             
            API_URL = "https://api-inference.huggingface.co/models/openskyml/dalle-3-xl"
         | 
| 9 | 
             
            API_TOKEN = os.getenv("HF_READ_TOKEN")
         | 
| 10 | 
             
            headers = {"Authorization": f"Bearer {API_TOKEN}"}
         | 
| 11 | 
             
            timeout = 100
         | 
| 12 | 
            +
            models_list = ["Реалистичность", "Аниме", "Disney"]
         | 
| 13 | 
            +
            def query(prompt, model, pose, vid, is_negative="[deformed | disfigured], poorly drawn, [bad : wrong] anatomy, [extra | missing | floating | disconnected] limb, (mutated hands and fingers), blurry, text, fuzziness", steps=45, cfg_scale=8, sampler="DPM++ 2M Karras", seed=-1, strength=0.7):
         | 
|  | |
|  | |
|  | |
| 14 | 
             
                if prompt == "" or prompt == None:
         | 
| 15 | 
             
                    return None
         | 
| 16 |  | 
|  | |
| 18 | 
             
                API_TOKEN = random.choice([os.getenv("HF_READ_TOKEN"), os.getenv("HF_READ_TOKEN_2"), os.getenv("HF_READ_TOKEN_3"), os.getenv("HF_READ_TOKEN_4"), os.getenv("HF_READ_TOKEN_5")]) # it is free
         | 
| 19 | 
             
                headers = {"Authorization": f"Bearer {API_TOKEN}"}
         | 
| 20 | 
             
                key = random.randint(0, 999)
         | 
|  | |
|  | |
|  | |
| 21 |  | 
| 22 | 
            +
                prompt = f"The {prompt} in a {pose} pose. View from {vid} | porn ultra detail, ultra elaboration, ultra quality, perfect."
         | 
| 23 | 
             
                print(f'\033[1mГенерация {key}:\033[0m {prompt}')
         | 
| 24 | 
            +
                if model == 'Реалистичность':
         | 
| 25 | 
             
                    API_URL = "https://api-inference.huggingface.co/models/openskyml/dalle-3-xl"
         | 
| 26 | 
            +
                    prompt = f"Ultra realistic porn. {prompt}"
         | 
| 27 | 
             
                if model == 'Playground 2':
         | 
| 28 | 
             
                    API_URL = "https://api-inference.huggingface.co/models/playgroundai/playground-v2-1024px-aesthetic"
         | 
| 29 | 
             
                if model == 'Openjourney 4':
         | 
|  | |
| 34 | 
             
                    API_URL = "https://api-inference.huggingface.co/models/stablediffusionapi/lyrielv16"
         | 
| 35 | 
             
                if model == 'Animagine XL 2.0':
         | 
| 36 | 
             
                    API_URL = "https://api-inference.huggingface.co/models/Linaqruf/animagine-xl-2.0"
         | 
| 37 | 
            +
                    prompt = f"Anime porn. {prompt}"
         | 
| 38 | 
             
                if model == 'Counterfeit 2.5':
         | 
| 39 | 
             
                    API_URL = "https://api-inference.huggingface.co/models/gsdf/Counterfeit-V2.5"
         | 
| 40 | 
             
                if model == 'Realistic Vision 5.1':
         | 
|  | |
| 43 | 
             
                    API_URL = "https://api-inference.huggingface.co/models/digiplay/incursiosMemeDiffusion_v1.6"
         | 
| 44 | 
             
                if model == 'Anime Detailer XL':
         | 
| 45 | 
             
                    API_URL = "https://api-inference.huggingface.co/models/Linaqruf/anime-detailer-xl-lora"
         | 
| 46 | 
            +
                    prompt = f"Anime porn. {prompt}"
         | 
| 47 | 
             
                if model == 'epiCRealism':
         | 
| 48 | 
             
                    API_URL = "https://api-inference.huggingface.co/models/emilianJR/epiCRealism"
         | 
| 49 | 
             
                if model == 'PixelArt XL':
         | 
|  | |
| 56 | 
             
                    API_URL = "https://api-inference.huggingface.co/models/DoctorDiffusion/doctor-diffusion-s-controllable-vector-art-xl-lora"
         | 
| 57 | 
             
                if model == 'Disney':
         | 
| 58 | 
             
                    API_URL = "https://api-inference.huggingface.co/models/goofyai/disney_style_xl"
         | 
| 59 | 
            +
                    prompt = f"Disney style porn. {prompt}"
         | 
| 60 | 
            +
                if model == 'Аниме':
         | 
| 61 | 
             
                    API_URL = "https://api-inference.huggingface.co/models/digiplay/CleanLinearMix_nsfw"
         | 
| 62 | 
            +
                    prompt = f"Anime porn. {prompt}"
         | 
| 63 | 
             
                if model == 'OrangeMixs':
         | 
| 64 | 
             
                    API_URL = "https://api-inference.huggingface.co/models/WarriorMama777/OrangeMixs"
         | 
| 65 |  | 
|  | |
| 96 | 
             
            """
         | 
| 97 |  | 
| 98 | 
             
            with gr.Blocks(css=css) as dalle:
         | 
| 99 | 
            +
                gr.Markdown("## 🔞 Strictly 18+ 🔞")
         | 
| 100 | 
             
                with gr.Tab("Базовые настройки"):
         | 
| 101 | 
             
                    with gr.Row():
         | 
| 102 | 
             
                        with gr.Column(elem_id="prompt-container"):
         | 
| 103 | 
             
                            with gr.Row():
         | 
| 104 | 
            +
                                image = gr.Dropdown(label="На фото", value="Naked girl", choices=["Naked girl", "Sex", "Blow job"])
         | 
| 105 | 
            +
                            with gr.Row():
         | 
| 106 | 
            +
                                model = gr.Radio(label="Стиль", value="Реалистичность", choices=models_list)
         | 
| 107 | 
             
                            with gr.Row():
         | 
| 108 | 
            +
                                pose = gr.Dropdown(label="Поза", value="Cancer", choices=["Cancer", "Lying down", "on my knees", "sitting"])
         | 
| 109 | 
            +
                            with gr.Row():
         | 
| 110 | 
            +
                                vid = gr.Dropdown(label="Вид", value="Random", choices=["Back", "Front", "Top", "Bottom", "Random"])
         | 
| 111 |  | 
| 112 |  | 
| 113 |  | 
|  | |
| 125 | 
             
                    with gr.Row():
         | 
| 126 | 
             
                        seed = gr.Slider(label="Seed", value=-1, minimum=-1, maximum=1000000000, step=1)
         | 
| 127 |  | 
| 128 | 
            +
                
         | 
|  | |
|  | |
|  | |
| 129 | 
             
                with gr.Row():
         | 
| 130 | 
             
                    text_button = gr.Button("Генерация", variant='primary', elem_id="gen-button")
         | 
| 131 | 
             
                with gr.Row():
         | 
| 132 | 
             
                    image_output = gr.Image(type="pil", label="Изображение", elem_id="gallery")
         | 
| 133 |  | 
| 134 | 
            +
                text_button.click(query, inputs=[image, model, pose, vid, negative_prompt, steps, cfg, method, seed, strength], outputs=image_output)
         | 
| 135 |  | 
| 136 | 
             
            dalle.launch(show_api=False, share=False)
         | 
 
			
