Spaces:
Sleeping
Sleeping
Commit
·
d274ee0
1
Parent(s):
91f32bc
Update gradio_app.py
Browse files- gradio_app.py +1 -1
gradio_app.py
CHANGED
@@ -58,7 +58,7 @@ def generate_answer(request: str, max_tokens: int = 256, language: str = "en", c
|
|
58 |
logs = f"Request: {request}\nMax tokens: {max_tokens}\nLanguage: {language}\nCustom prompt: {custom_prompt}\n"
|
59 |
try:
|
60 |
maxTokens = max_tokens if 16 <= max_tokens <= 256 else 64
|
61 |
-
if isinstance(custom_prompt, str):
|
62 |
userPrompt = custom_prompt.replace("{prompt}", request)
|
63 |
else:
|
64 |
userPrompt = prompt.replace("{prompt}", request)
|
|
|
58 |
logs = f"Request: {request}\nMax tokens: {max_tokens}\nLanguage: {language}\nCustom prompt: {custom_prompt}\n"
|
59 |
try:
|
60 |
maxTokens = max_tokens if 16 <= max_tokens <= 256 else 64
|
61 |
+
if isinstance(custom_prompt, str) and len(custom_prompt.strip()) > 1 and custom_prompt.strip() not in ['', None, ' ']:
|
62 |
userPrompt = custom_prompt.replace("{prompt}", request)
|
63 |
else:
|
64 |
userPrompt = prompt.replace("{prompt}", request)
|