Spaces:
Sleeping
Sleeping
Rename meta_prompt.py to text-prompt.py
Browse files- meta_prompt.py +0 -26
- text-prompt.py +6 -0
meta_prompt.py
DELETED
|
@@ -1,26 +0,0 @@
|
|
| 1 |
-
from typing import Callable
|
| 2 |
-
|
| 3 |
-
PROMPTS_SYS = {
|
| 4 |
-
"default": lambda base_text: (f"Below is an image of a document page along with its dimensions. "
|
| 5 |
-
f"Simply return the markdown representation of this document, presenting tables in markdown format as they naturally appear.\n"
|
| 6 |
-
f"If the document contains images, use a placeholder like dummy.png for each image.\n"
|
| 7 |
-
f"Your final output must be in JSON format with a single key `natural_text` containing the response.\n"
|
| 8 |
-
f"RAW_TEXT_START\n{base_text}\nRAW_TEXT_END"),
|
| 9 |
-
"structure": lambda base_text: (
|
| 10 |
-
f"Below is an image of a document page, along with its dimensions and possibly some raw textual content previously extracted from it. "
|
| 11 |
-
f"Note that the text extraction may be incomplete or partially missing. Carefully consider both the layout and any available text to reconstruct the document accurately.\n"
|
| 12 |
-
f"Your task is to return the markdown representation of this document, presenting tables in HTML format as they naturally appear.\n"
|
| 13 |
-
f"If the document contains images or figures, analyze them and include the tag <figure>IMAGE_ANALYSIS</figure> in the appropriate location.\n"
|
| 14 |
-
f"Your final output must be in JSON format with a single key `natural_text` containing the response.\n"
|
| 15 |
-
f"RAW_TEXT_START\n{base_text}\nRAW_TEXT_END"
|
| 16 |
-
),
|
| 17 |
-
}
|
| 18 |
-
|
| 19 |
-
def get_prompt(prompt_name: str) -> Callable[[str], str]:
|
| 20 |
-
"""
|
| 21 |
-
Fetches the system prompt based on the provided PROMPT_NAME.
|
| 22 |
-
|
| 23 |
-
:param prompt_name: The identifier for the desired prompt.
|
| 24 |
-
:return: The system prompt as a string.
|
| 25 |
-
"""
|
| 26 |
-
return PROMPTS_SYS.get(prompt_name, lambda x: "Invalid PROMPT_NAME provided.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
text-prompt.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
SYSTEM_PROMPT = (
|
| 2 |
+
"Ты компетентный редактор русского языка. "
|
| 3 |
+
"Преобразуй дореформенную русскую орфографию (до 1918 года) "
|
| 4 |
+
"в современную орфографию. Сохраняй смысл, пунктуацию и регистр. "
|
| 5 |
+
"Не добавляй комментариев. Верни только преобразованный текст."
|
| 6 |
+
)
|