Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -25,7 +25,7 @@ def enhance_prompt(prompt, style="photorealistic"):
|
|
25 |
)
|
26 |
return result
|
27 |
|
28 |
-
def mistral_nemo_call(prompt, model="mistralai/Mistral-Nemo-Instruct-2407"):
|
29 |
|
30 |
client = InferenceClient(api_key=API_TOKEN)
|
31 |
system_prompt=f"""
|
@@ -36,7 +36,7 @@ def mistral_nemo_call(prompt, model="mistralai/Mistral-Nemo-Instruct-2407"):
|
|
36 |
|
37 |
response = ""
|
38 |
for message in client.chat_completion(
|
39 |
-
model=
|
40 |
messages=[{"role": "system", "content": system_prompt},{"role": "user", "content": prompt}],
|
41 |
max_tokens=500,
|
42 |
stream=True,
|
@@ -75,7 +75,7 @@ def query(prompt, is_negative=False, steps=30, cfg_scale=7, sampler="DPM++ 2M Ka
|
|
75 |
prompt = enhance_prompt(prompt)
|
76 |
print(f'\033[1mGeneration {key} enhanced prompt:\033[0m {prompt}')
|
77 |
if use_mistral_nemo:
|
78 |
-
prompt = mistral_nemo_call(prompt)
|
79 |
print(f'\033[1mGeneration {key} Mistral-Nemo prompt:\033[0m {prompt}')
|
80 |
|
81 |
final_prompt = f"{prompt} | ultra detail, ultra elaboration, ultra quality, perfect."
|
|
|
25 |
)
|
26 |
return result
|
27 |
|
28 |
+
def mistral_nemo_call(prompt, API_TOKEN, model="mistralai/Mistral-Nemo-Instruct-2407"):
|
29 |
|
30 |
client = InferenceClient(api_key=API_TOKEN)
|
31 |
system_prompt=f"""
|
|
|
36 |
|
37 |
response = ""
|
38 |
for message in client.chat_completion(
|
39 |
+
model=model,
|
40 |
messages=[{"role": "system", "content": system_prompt},{"role": "user", "content": prompt}],
|
41 |
max_tokens=500,
|
42 |
stream=True,
|
|
|
75 |
prompt = enhance_prompt(prompt)
|
76 |
print(f'\033[1mGeneration {key} enhanced prompt:\033[0m {prompt}')
|
77 |
if use_mistral_nemo:
|
78 |
+
prompt = mistral_nemo_call(prompt,API_TOKEN=API_TOKEN)
|
79 |
print(f'\033[1mGeneration {key} Mistral-Nemo prompt:\033[0m {prompt}')
|
80 |
|
81 |
final_prompt = f"{prompt} | ultra detail, ultra elaboration, ultra quality, perfect."
|