Skip to content

Commit cd63d38

Browse files
author
PHAN Xuan Quang
committed
fix prompt
1 parent ad3d45b commit cd63d38

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

XCan.Api/Controllers/MainController.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public async Task<ActionResult<string>> ExtractTextFromImage([FromBody] string i
5757

5858
try
5959
{
60-
var instruction = @"You are an AI designed especially to extract the text from image. Ensure that the output is **as accurate as possible"", and maintaining the structure without adding or removing any information. Try you best to preserve the **format** of the original text (using Markdown syntax if needed), including paragraph breaks and punctuation, tables, programming code, etc. If you cannot find any text in the image, response with the 'Text Not Found'.";
60+
var instruction = @"You are an AI designed especially to extract the text from image. Ensure that the output is **as accurate as possible**, and maintaining the structure without adding or removing any information. Try you best to preserve the **format** of the original text (using Markdown syntax if needed), including paragraph breaks and punctuation, tables, programming code, etc. Additionally, you should also consider the language of the content in the image to reproduce the output text appropriately (for ex: the way text is presented in English is different from in Japanese or Chinese). If you cannot find any text in the image, response with the 'Text Not Found'. ";
6161
var prompt = "This is the image for you to extract text.";
6262
var result = await Generator.ContentFromImage(apiKey, instruction.Trim(), prompt, image, false, 10);
6363
return Ok(result.Trim());
@@ -88,7 +88,7 @@ public async Task<ActionResult<string>> TranslateTextToVietnamese([FromBody] Req
8888

8989
try
9090
{
91-
var instruction = "You are a translator with over 30 years of experience from any languages to Vietnamese. You have to help me to translate the provided text from its original language into Vietnamese. You should also check the provided image that contains the text, it may be helpful for you to understand the context of the text. Ensure that the translation is **accurate (following the context in the provided image), maintaining the original meaning, tone, and structure** without adding or removing any information. Preserve the **format** of the original text, including paragraph breaks and punctuation. In case the text contains professional terms and you do not know how to translate them into Vietnamese, **keep them as the original**. **Do not** alter the content or provide extra explanations or comments, only provide me the corresponding Vietnamese translation.";
91+
var instruction = "You are a translator with over 30 years of experience from any languages to Vietnamese. I will provide you with the image and the text that I extracted from the image (may not be accurate). Please help me to translate the text in the provided image from its original language into Vietnamese. You should also check the provided image that contains the text, because I think it can help you to understand the context of the text. Ensure that the translation is **as accurate as possible (following the context in the provided image), maintaining the original meaning, tone, and structure** without adding or removing any information. Preserve the **format** of the original text, including paragraph breaks and punctuation. In case the text contains professional terms and you do not know how to translate them into Vietnamese, **keep them as the original**. **Do not** alter the content or provide extra explanations or comments, only provide me the corresponding Vietnamese translation.";
9292

9393
var image = content.Base64Img
9494
.Replace("data:image/png;base64,", string.Empty)

0 commit comments

Comments
 (0)