Spaces:
Runtime error
Runtime error
Update Flux.py
Browse files
Flux.py
CHANGED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
from gradio_client import Client
|
3 |
+
|
4 |
+
token=os.getenv('HF_WRITE_TOKEN')
|
5 |
+
|
6 |
+
class capacitor:
|
7 |
+
def __init__(self, client="K00B404/FluxCapacitor" ):
|
8 |
+
self.token = token
|
9 |
+
self.client = Client(client, hf_token=self.token)
|
10 |
+
|
11 |
+
|
12 |
+
def generate(self prompt,neg=None, steps=35,cfg_scale=7,sampler="DPM++ 2M Karras",seed=-1,strength=0.7,use_dev=False,enhance_prompt_style="Hello!!",enhance_prompt_option=False,nemo_enhance_prompt_style="Hello!!",use_mistral_nemo=False,):
|
13 |
+
img_path,seed,used_prompt = client.predict(
|
14 |
+
prompt=prompt,
|
15 |
+
is_negative="(deformed, distorted, disfigured), poorly drawn, bad anatomy, wrong anatomy, extra limb, missing limb, floating limbs, (mutated hands and fingers), disconnected limbs, mutation, mutated, ugly, disgusting, blurry, amputation, misspellings, typos" if not neg else neg,
|
16 |
+
steps=steps,
|
17 |
+
cfg_scale=cfg_scale,
|
18 |
+
sampler=sampler,
|
19 |
+
seed=seed,
|
20 |
+
strength=v,
|
21 |
+
huggingface_api_key=self.token,
|
22 |
+
use_dev=use_dev,
|
23 |
+
enhance_prompt_style=enhance_prompt_style,
|
24 |
+
enhance_prompt_option=enhance_prompt_option,
|
25 |
+
nemo_enhance_prompt_style=nemo_enhance_prompt_style,
|
26 |
+
use_mistral_nemo=use_mistral_nemo,
|
27 |
+
api_name="/query"
|
28 |
+
)
|
29 |
+
print(img_path,seed,used_prompt )
|
30 |
+
return img_path,seed,used_prompt
|