Commit
·
23ee02b
1
Parent(s):
4c39c86
trial
Browse files
app.py
CHANGED
|
@@ -23,26 +23,24 @@ def create_interface():
|
|
| 23 |
|
| 24 |
with gr.Row():
|
| 25 |
with gr.Column(scale=2):
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
# Connect the update_prompt_type function to the prompt_type dropdown
|
| 45 |
-
prompt_type.change(update_prompt_type, inputs=[prompt_type], outputs=[prompt_type])
|
| 46 |
|
| 47 |
with gr.Column(scale=2):
|
| 48 |
with gr.Accordion("LLM Prompt Generation", open=False):
|
|
@@ -87,6 +85,7 @@ def create_interface():
|
|
| 87 |
|
| 88 |
# **Unified Function to Generate Prompt and Text**
|
| 89 |
def generate_random_prompt_with_llm(custom_input, prompt_type, long_talk, compress, compression_level, custom_base_prompt, provider, api_key, model_selected):
|
|
|
|
| 90 |
try:
|
| 91 |
# Step 1: Generate Prompt
|
| 92 |
dynamic_seed = random.randint(0, 1000000)
|
|
|
|
| 23 |
|
| 24 |
with gr.Row():
|
| 25 |
with gr.Column(scale=2):
|
| 26 |
+
custom = gr.Textbox(label="Custom Input Prompt (optional)")
|
| 27 |
+
|
| 28 |
+
prompt_type = gr.Dropdown(
|
| 29 |
+
choices=["Long", "Short", "Medium", "OnlyObjects", "NoFigure", "Landscape", "Fantasy"],
|
| 30 |
+
label="Prompt Type",
|
| 31 |
+
value="Long",
|
| 32 |
+
interactive=True
|
| 33 |
+
)
|
| 34 |
+
|
| 35 |
+
# Function to update the selected prompt type
|
| 36 |
+
def update_prompt_type(value):
|
| 37 |
+
global selected_prompt_type
|
| 38 |
+
selected_prompt_type = value
|
| 39 |
+
print(f"Updated prompt type: {selected_prompt_type}")
|
| 40 |
+
return value
|
| 41 |
+
|
| 42 |
+
# Connect the update_prompt_type function to the prompt_type dropdown
|
| 43 |
+
prompt_type.change(update_prompt_type, inputs=[prompt_type], outputs=[prompt_type])
|
|
|
|
|
|
|
| 44 |
|
| 45 |
with gr.Column(scale=2):
|
| 46 |
with gr.Accordion("LLM Prompt Generation", open=False):
|
|
|
|
| 85 |
|
| 86 |
# **Unified Function to Generate Prompt and Text**
|
| 87 |
def generate_random_prompt_with_llm(custom_input, prompt_type, long_talk, compress, compression_level, custom_base_prompt, provider, api_key, model_selected):
|
| 88 |
+
global selected_prompt_type # Declare as global
|
| 89 |
try:
|
| 90 |
# Step 1: Generate Prompt
|
| 91 |
dynamic_seed = random.randint(0, 1000000)
|