mrbeliever
commited on
Commit
•
e29eb69
1
Parent(s):
f85f7c4
Update app.py
Browse files
app.py
CHANGED
@@ -67,12 +67,21 @@ def upload(files: Optional[List[str]], chatbot: CHAT_HISTORY) -> CHAT_HISTORY:
|
|
67 |
return chatbot
|
68 |
|
69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
def user(text_prompt: str, chatbot: CHAT_HISTORY):
|
71 |
if text_prompt:
|
72 |
-
|
|
|
73 |
return "", chatbot
|
74 |
|
75 |
|
|
|
76 |
def bot(
|
77 |
google_key: str,
|
78 |
files: Optional[List[str]],
|
@@ -144,12 +153,13 @@ chatbot_component = gr.Chatbot(
|
|
144 |
height=400
|
145 |
)
|
146 |
text_prompt_component = gr.Textbox(
|
147 |
-
value="
|
148 |
-
placeholder="Type or Paste Your Prompt",
|
149 |
show_label=False,
|
150 |
autofocus=True,
|
151 |
scale=8
|
152 |
)
|
|
|
153 |
upload_button_component = gr.UploadButton(
|
154 |
label="Upload Images", file_count="multiple", file_types=["image"], scale=1
|
155 |
)
|
|
|
67 |
return chatbot
|
68 |
|
69 |
|
70 |
+
# Concatenate the hidden pre-filled text with the user input
|
71 |
+
prefilled_text = "You are a specialized Prompt Generator focused on improving the original text while maintaining its essence. Keep the prompt length under 50 words never exceed this limit"
|
72 |
+
|
73 |
+
def get_prefilled_text(user_input):
|
74 |
+
return f"{prefilled_text} + {user_input}"
|
75 |
+
|
76 |
+
# Update the user input function to use the concatenated text
|
77 |
def user(text_prompt: str, chatbot: CHAT_HISTORY):
|
78 |
if text_prompt:
|
79 |
+
prefilled_with_user_input = get_prefilled_text(text_prompt)
|
80 |
+
chatbot.append((prefilled_with_user_input, None))
|
81 |
return "", chatbot
|
82 |
|
83 |
|
84 |
+
|
85 |
def bot(
|
86 |
google_key: str,
|
87 |
files: Optional[List[str]],
|
|
|
153 |
height=400
|
154 |
)
|
155 |
text_prompt_component = gr.Textbox(
|
156 |
+
value="",
|
157 |
+
placeholder="Type or Paste Your Prompt Here",
|
158 |
show_label=False,
|
159 |
autofocus=True,
|
160 |
scale=8
|
161 |
)
|
162 |
+
|
163 |
upload_button_component = gr.UploadButton(
|
164 |
label="Upload Images", file_count="multiple", file_types=["image"], scale=1
|
165 |
)
|