Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
from PIL import Image
|
| 2 |
import gradio as gr
|
| 3 |
import torch
|
| 4 |
-
from diffusers import
|
| 5 |
from groq import Groq # Import the Groq library
|
| 6 |
from cryptography.fernet import Fernet
|
| 7 |
from huggingface_hub import login
|
|
@@ -25,9 +25,12 @@ def get_hf_token(encrypted_token):
|
|
| 25 |
groq_client = Groq(api_key="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")
|
| 26 |
decrypted_token = get_hf_token("gAAAAABn3GfShExoJd50nau3B5ZJNiQ9dRD1ACO3XXMwVaIQMkmi59cL-MKGr6SYnsB0E2gGITJG2j29Ar9yjaZP-EC6hHsCBmwKSj4aFtTor9_n0_NdMBv1GtlxZRmwnQwriB-Xr94e")
|
| 27 |
login(token=decrypted_token)
|
| 28 |
-
|
|
|
|
|
|
|
| 29 |
pipe.enable_model_cpu_offload() #save some VRAM by offloading the model to CPU. Remove this if you have enough GPU power
|
| 30 |
|
|
|
|
| 31 |
def enhance_prompt(user_prompt):
|
| 32 |
"""Enhances the given prompt using Groq and returns the refined prompt."""
|
| 33 |
try:
|
|
|
|
| 1 |
from PIL import Image
|
| 2 |
import gradio as gr
|
| 3 |
import torch
|
| 4 |
+
from diffusers import FluxPipeline
|
| 5 |
from groq import Groq # Import the Groq library
|
| 6 |
from cryptography.fernet import Fernet
|
| 7 |
from huggingface_hub import login
|
|
|
|
| 25 |
groq_client = Groq(api_key="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")
|
| 26 |
decrypted_token = get_hf_token("gAAAAABn3GfShExoJd50nau3B5ZJNiQ9dRD1ACO3XXMwVaIQMkmi59cL-MKGr6SYnsB0E2gGITJG2j29Ar9yjaZP-EC6hHsCBmwKSj4aFtTor9_n0_NdMBv1GtlxZRmwnQwriB-Xr94e")
|
| 27 |
login(token=decrypted_token)
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-schnell", torch_dtype=torch.bfloat16)
|
| 31 |
pipe.enable_model_cpu_offload() #save some VRAM by offloading the model to CPU. Remove this if you have enough GPU power
|
| 32 |
|
| 33 |
+
|
| 34 |
def enhance_prompt(user_prompt):
|
| 35 |
"""Enhances the given prompt using Groq and returns the refined prompt."""
|
| 36 |
try:
|