Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
8433342
1
Parent(s):
9d92743
prompt_types
Browse files- huggingface_inference_node.py +4 -2
- ui_components.py +5 -1
huggingface_inference_node.py
CHANGED
|
@@ -62,14 +62,16 @@ You are allowed to make up film and branding names, and do them like 80's, 90's
|
|
| 62 |
"fantasy": fantasy_prompt
|
| 63 |
}
|
| 64 |
|
| 65 |
-
|
|
|
|
| 66 |
base_prompt = prompt_types[prompt_type]
|
| 67 |
print(f"Using {prompt_type} prompt")
|
| 68 |
elif custom_base_prompt.strip():
|
| 69 |
base_prompt = custom_base_prompt
|
|
|
|
| 70 |
else:
|
| 71 |
base_prompt = default_happy_prompt
|
| 72 |
-
print(f"Warning: Unknown prompt type '{prompt_type}'. Using default happy prompt.")
|
| 73 |
|
| 74 |
if compress and not poster:
|
| 75 |
compression_chars = {
|
|
|
|
| 62 |
"fantasy": fantasy_prompt
|
| 63 |
}
|
| 64 |
|
| 65 |
+
# Update this part to handle the prompt_type correctly
|
| 66 |
+
if prompt_type and prompt_type in prompt_types:
|
| 67 |
base_prompt = prompt_types[prompt_type]
|
| 68 |
print(f"Using {prompt_type} prompt")
|
| 69 |
elif custom_base_prompt.strip():
|
| 70 |
base_prompt = custom_base_prompt
|
| 71 |
+
print("Using custom base prompt")
|
| 72 |
else:
|
| 73 |
base_prompt = default_happy_prompt
|
| 74 |
+
print(f"Warning: Unknown or empty prompt type '{prompt_type}'. Using default happy prompt.")
|
| 75 |
|
| 76 |
if compress and not poster:
|
| 77 |
compression_chars = {
|
ui_components.py
CHANGED
|
@@ -163,8 +163,12 @@ def create_interface():
|
|
| 163 |
outputs=[output]
|
| 164 |
)
|
| 165 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 166 |
generate_text_button.click(
|
| 167 |
-
|
| 168 |
inputs=[output, happy_talk, compress, compression_level, prompt_type, custom_base_prompt],
|
| 169 |
outputs=text_output
|
| 170 |
)
|
|
|
|
| 163 |
outputs=[output]
|
| 164 |
)
|
| 165 |
|
| 166 |
+
def generate_text_with_llm(output, happy_talk, compress, compression_level, prompt_type, custom_base_prompt):
|
| 167 |
+
print(f"Prompt type selected: {prompt_type}") # Debug print
|
| 168 |
+
return huggingface_node.generate(output, happy_talk, compress, compression_level, prompt_type, custom_base_prompt)
|
| 169 |
+
|
| 170 |
generate_text_button.click(
|
| 171 |
+
generate_text_with_llm,
|
| 172 |
inputs=[output, happy_talk, compress, compression_level, prompt_type, custom_base_prompt],
|
| 173 |
outputs=text_output
|
| 174 |
)
|