@@ -104,17 +104,13 @@ public async Task<ActionResult<string>> ExtractTextFromImage([FromBody] string i
104
104
- **Fallback for Missing Emojis**: Provide text descriptions for emojis to maintain context.
105
105
106
106
**Output Requirements**:
107
- - Default to Markdown for core formatting, using HTML and CSS for complex elements.
108
- - Ensure all extracted text and elements closely match the original layout, maintaining details and structures.
109
- - Provide clear notes for any elements not replicable in Markdown, using HTML and CSS to enhance visibility and formatting.
110
- - Response with the 'Text Not Found' if you can't find any text in the image that I provide." ;
107
+ - **Default** to Markdown for core formatting, using HTML and CSS for complex elements.
108
+ - Ensure all extracted text and elements **closely match** the original layout, maintaining details and structures.
109
+ - The output content **must not** be wrapped as a fenced code block (""```html"", ""```markdown"", etc).
110
+ - Provide **clear notes** for any elements not replicable in Markdown, using HTML and CSS to enhance visibility and formatting.
111
+ - Response with the **Text Not Found** if you can't find any text in the provided image." ;
111
112
var prompt = "This is the image for you to extract text." ;
112
113
var result = await Generator . ContentFromImage ( apiKey , instruction , prompt , image , false , 20 ) ;
113
- if ( result . StartsWith ( "```" ) && result . EndsWith ( "```" ) )
114
- {
115
- var lines = result . Split ( Environment . NewLine ) ;
116
- result = string . Join ( Environment . NewLine , lines . Skip ( 1 ) . Take ( lines . Length - 2 ) ) ;
117
- }
118
114
return Ok ( result . Trim ( ) ) ;
119
115
}
120
116
catch ( Exception ex )
@@ -154,11 +150,6 @@ public async Task<ActionResult<string>> TranslateTextToVietnamese([FromBody] Req
154
150
. Trim ( ) ;
155
151
156
152
var result = await Generator . ContentFromImage ( apiKey , instruction . Trim ( ) , content . ExtractedContent . Trim ( ) , image , false , 50 ) ;
157
- if ( result . StartsWith ( "```" ) && result . EndsWith ( "```" ) )
158
- {
159
- var lines = result . Split ( Environment . NewLine ) ;
160
- result = string . Join ( Environment . NewLine , lines . Skip ( 1 ) . Take ( lines . Length - 2 ) ) ;
161
- }
162
153
163
154
return Ok ( result . Trim ( ) ) ;
164
155
}
0 commit comments