Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,6 +13,20 @@ API_TOKEN = os.getenv("HF_READ_TOKEN")
|
|
| 13 |
headers = {"Authorization": f"Bearer {API_TOKEN}"}
|
| 14 |
timeout = 100
|
| 15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
def query(lora_id, prompt, is_negative=False, steps=28, cfg_scale=3.5, sampler="DPM++ 2M Karras", seed=-1, strength=0.7):
|
| 17 |
if prompt == "" or prompt == None:
|
| 18 |
return None
|
|
@@ -27,11 +41,11 @@ def query(lora_id, prompt, is_negative=False, steps=28, cfg_scale=3.5, sampler="
|
|
| 27 |
API_TOKEN = random.choice([os.getenv("HF_READ_TOKEN")])
|
| 28 |
headers = {"Authorization": f"Bearer {API_TOKEN}"}
|
| 29 |
|
| 30 |
-
prompt = GoogleTranslator(source='ru', target='en').translate(prompt)
|
| 31 |
-
print(f'\033[1mGeneration {key} translation:\033[0m {prompt}')
|
| 32 |
|
| 33 |
prompt = f"{prompt} | ultra detail, ultra elaboration, ultra quality, perfect."
|
| 34 |
-
print(f'\033[1mGeneration {key}:\033[0m {prompt}')
|
| 35 |
|
| 36 |
# If seed is -1, generate a random seed and use it
|
| 37 |
if seed == -1:
|
|
@@ -105,6 +119,8 @@ with gr.Blocks(theme='Nymbo/Nymbo_Theme', css=css) as app:
|
|
| 105 |
examples = examples,
|
| 106 |
inputs = [text_prompt],
|
| 107 |
)
|
|
|
|
|
|
|
| 108 |
|
| 109 |
text_button.click(query, inputs=[custom_lora, text_prompt, negative_prompt, steps, cfg, method, seed, strength], outputs=[image_output,seed_output])
|
| 110 |
|
|
|
|
| 13 |
headers = {"Authorization": f"Bearer {API_TOKEN}"}
|
| 14 |
timeout = 100
|
| 15 |
|
| 16 |
+
article_text = """
|
| 17 |
+
<div style="text-align: center;">
|
| 18 |
+
<p>Enjoying the tool? Buy me a coffee and get exclusive prompt guides!</p>
|
| 19 |
+
<p><i>Instantly unlock helpful tips for creating better prompts!</i></p>
|
| 20 |
+
<div style="display: flex; justify-content: center;">
|
| 21 |
+
<a href="https://piczify.lemonsqueezy.com/buy/0f5206fa-68e8-42f6-9ca8-4f80c587c83e">
|
| 22 |
+
<img src="https://www.buymeacoffee.com/assets/img/custom_images/yellow_img.png"
|
| 23 |
+
alt="Buy Me a Coffee"
|
| 24 |
+
style="height: 40px; width: auto; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); border-radius: 10px;">
|
| 25 |
+
</a>
|
| 26 |
+
</div>
|
| 27 |
+
</div>
|
| 28 |
+
"""
|
| 29 |
+
|
| 30 |
def query(lora_id, prompt, is_negative=False, steps=28, cfg_scale=3.5, sampler="DPM++ 2M Karras", seed=-1, strength=0.7):
|
| 31 |
if prompt == "" or prompt == None:
|
| 32 |
return None
|
|
|
|
| 41 |
API_TOKEN = random.choice([os.getenv("HF_READ_TOKEN")])
|
| 42 |
headers = {"Authorization": f"Bearer {API_TOKEN}"}
|
| 43 |
|
| 44 |
+
# prompt = GoogleTranslator(source='ru', target='en').translate(prompt)
|
| 45 |
+
# print(f'\033[1mGeneration {key} translation:\033[0m {prompt}')
|
| 46 |
|
| 47 |
prompt = f"{prompt} | ultra detail, ultra elaboration, ultra quality, perfect."
|
| 48 |
+
# print(f'\033[1mGeneration {key}:\033[0m {prompt}')
|
| 49 |
|
| 50 |
# If seed is -1, generate a random seed and use it
|
| 51 |
if seed == -1:
|
|
|
|
| 119 |
examples = examples,
|
| 120 |
inputs = [text_prompt],
|
| 121 |
)
|
| 122 |
+
|
| 123 |
+
gr.Markdown(article_text)
|
| 124 |
|
| 125 |
text_button.click(query, inputs=[custom_lora, text_prompt, negative_prompt, steps, cfg, method, seed, strength], outputs=[image_output,seed_output])
|
| 126 |
|