Spaces:
Sleeping
Sleeping
Оновлено типи аналізу за замовчуванням у Gradio інтерфейсі на "Content Summary" та "Gemini 2.0 Flash". Внесено зміни до системних повідомлень для покращення контексту аналізу, щоб відображати мову оригінального документа. Видалено застаріле повідомлення про виправлення у відображенні результатів.
Browse files- app_interface.py +2 -16
- app_logic.py +2 -2
- llm/gemini_connector.py +4 -4
app_interface.py
CHANGED
|
@@ -552,7 +552,7 @@ class MarkItDownTestingApp:
|
|
| 552 |
("Content Summary - Тематичний аналіз та ключові інсайти", "content_summary"),
|
| 553 |
("Extraction Quality - Оцінка збереження даних", "extraction_quality"),
|
| 554 |
],
|
| 555 |
-
value="
|
| 556 |
label="Analysis Type",
|
| 557 |
interactive=True,
|
| 558 |
)
|
|
@@ -565,7 +565,7 @@ class MarkItDownTestingApp:
|
|
| 565 |
("Gemini 1.5 Pro (Legacy)", GeminiModel.LEGACY_PRO.value),
|
| 566 |
("Gemini 1.5 Flash (Legacy)", GeminiModel.LEGACY_FLASH.value),
|
| 567 |
],
|
| 568 |
-
value=GeminiModel.
|
| 569 |
label="AI Model Preference",
|
| 570 |
interactive=True,
|
| 571 |
)
|
|
@@ -586,20 +586,6 @@ class MarkItDownTestingApp:
|
|
| 586 |
with gr.Column(scale=2):
|
| 587 |
gr.Markdown("### 📊 Processing Results")
|
| 588 |
|
| 589 |
-
# 🚨 ДОДАНО ВАЖЛИВЕ ПОВІДОМЛЕННЯ ПРО ВИПРАВЛЕННЯ
|
| 590 |
-
gr.HTML("""
|
| 591 |
-
<div style="background: #d1ecf1; border: 1px solid #bee5eb; padding: 15px; border-radius: 8px; margin-bottom: 20px;">
|
| 592 |
-
<h4 style="margin: 0 0 10px 0; color: #0c5460;">🔧 Architectural Fix Applied</h4>
|
| 593 |
-
<p style="margin: 0; color: #0c5460;"><strong>Fixed Issue:</strong> Different analysis types now show different results in Markdown Output!</p>
|
| 594 |
-
<ul style="margin: 10px 0 0 20px; color: #0c5460;">
|
| 595 |
-
<li><strong>Quality Analysis:</strong> Shows detailed quality metrics and AI feedback</li>
|
| 596 |
-
<li><strong>Structure Review:</strong> Shows document structure analysis and organization</li>
|
| 597 |
-
<li><strong>Content Summary:</strong> Shows thematic analysis and key insights</li>
|
| 598 |
-
<li><strong>Extraction Quality:</strong> Shows data preservation assessment</li>
|
| 599 |
-
</ul>
|
| 600 |
-
</div>
|
| 601 |
-
""")
|
| 602 |
-
|
| 603 |
status_display = gr.HTML()
|
| 604 |
|
| 605 |
with gr.Tabs():
|
|
|
|
| 552 |
("Content Summary - Тематичний аналіз та ключові інсайти", "content_summary"),
|
| 553 |
("Extraction Quality - Оцінка збереження даних", "extraction_quality"),
|
| 554 |
],
|
| 555 |
+
value="content_summary",
|
| 556 |
label="Analysis Type",
|
| 557 |
interactive=True,
|
| 558 |
)
|
|
|
|
| 565 |
("Gemini 1.5 Pro (Legacy)", GeminiModel.LEGACY_PRO.value),
|
| 566 |
("Gemini 1.5 Flash (Legacy)", GeminiModel.LEGACY_FLASH.value),
|
| 567 |
],
|
| 568 |
+
value=GeminiModel.FLASH.value,
|
| 569 |
label="AI Model Preference",
|
| 570 |
interactive=True,
|
| 571 |
)
|
|
|
|
| 586 |
with gr.Column(scale=2):
|
| 587 |
gr.Markdown("### 📊 Processing Results")
|
| 588 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 589 |
status_display = gr.HTML()
|
| 590 |
|
| 591 |
with gr.Tabs():
|
app_logic.py
CHANGED
|
@@ -38,8 +38,8 @@ class ProcessingRequest:
|
|
| 38 |
file_content: bytes
|
| 39 |
file_metadata: JSONDict
|
| 40 |
gemini_api_key: Optional[str] = None
|
| 41 |
-
analysis_type: str = AnalysisType.
|
| 42 |
-
model_preference: str = GeminiModel.
|
| 43 |
use_llm: bool = False
|
| 44 |
enable_plugins: bool = False
|
| 45 |
azure_endpoint: Optional[str] = None
|
|
|
|
| 38 |
file_content: bytes
|
| 39 |
file_metadata: JSONDict
|
| 40 |
gemini_api_key: Optional[str] = None
|
| 41 |
+
analysis_type: str = AnalysisType.CONTENT_SUMMARY.value
|
| 42 |
+
model_preference: str = GeminiModel.FLASH.value
|
| 43 |
use_llm: bool = False
|
| 44 |
enable_plugins: bool = False
|
| 45 |
azure_endpoint: Optional[str] = None
|
llm/gemini_connector.py
CHANGED
|
@@ -155,7 +155,7 @@ class GeminiAnalysisEngine:
|
|
| 155 |
ANALYSIS_PROMPTS = {
|
| 156 |
AnalysisType.QUALITY_ANALYSIS: {
|
| 157 |
"system": """You are an expert document conversion analyst specializing in evaluating
|
| 158 |
-
the quality of document-to-Markdown conversions.""",
|
| 159 |
"template": """
|
| 160 |
Analyze the quality of this Markdown conversion from a document.
|
| 161 |
|
|
@@ -187,7 +187,7 @@ class GeminiAnalysisEngine:
|
|
| 187 |
|
| 188 |
AnalysisType.STRUCTURE_REVIEW: {
|
| 189 |
"system": """You are a document structure specialist analyzing Markdown
|
| 190 |
-
document organization and hierarchy.""",
|
| 191 |
"template": """
|
| 192 |
Conduct a comprehensive structural analysis of this Markdown document.
|
| 193 |
|
|
@@ -219,7 +219,7 @@ class GeminiAnalysisEngine:
|
|
| 219 |
|
| 220 |
AnalysisType.CONTENT_SUMMARY: {
|
| 221 |
"system": """You are a content analysis expert specializing in document
|
| 222 |
-
summarization and thematic analysis.""",
|
| 223 |
"template": """
|
| 224 |
Create a comprehensive content summary and thematic analysis of this document.
|
| 225 |
|
|
@@ -251,7 +251,7 @@ class GeminiAnalysisEngine:
|
|
| 251 |
|
| 252 |
AnalysisType.EXTRACTION_QUALITY: {
|
| 253 |
"system": """You are a data extraction quality specialist evaluating how well
|
| 254 |
-
information was preserved during document conversion.""",
|
| 255 |
"template": """
|
| 256 |
Evaluate the extraction quality and information preservation in this converted document.
|
| 257 |
|
|
|
|
| 155 |
ANALYSIS_PROMPTS = {
|
| 156 |
AnalysisType.QUALITY_ANALYSIS: {
|
| 157 |
"system": """You are an expert document conversion analyst specializing in evaluating
|
| 158 |
+
the quality of document-to-Markdown conversions (use the language of the original document).""",
|
| 159 |
"template": """
|
| 160 |
Analyze the quality of this Markdown conversion from a document.
|
| 161 |
|
|
|
|
| 187 |
|
| 188 |
AnalysisType.STRUCTURE_REVIEW: {
|
| 189 |
"system": """You are a document structure specialist analyzing Markdown
|
| 190 |
+
document organization and hierarchy (use the language of the original document).""",
|
| 191 |
"template": """
|
| 192 |
Conduct a comprehensive structural analysis of this Markdown document.
|
| 193 |
|
|
|
|
| 219 |
|
| 220 |
AnalysisType.CONTENT_SUMMARY: {
|
| 221 |
"system": """You are a content analysis expert specializing in document
|
| 222 |
+
summarization and thematic analysis (use the language of the original document).""",
|
| 223 |
"template": """
|
| 224 |
Create a comprehensive content summary and thematic analysis of this document.
|
| 225 |
|
|
|
|
| 251 |
|
| 252 |
AnalysisType.EXTRACTION_QUALITY: {
|
| 253 |
"system": """You are a data extraction quality specialist evaluating how well
|
| 254 |
+
information was preserved during document conversion (use the language of the original document).""",
|
| 255 |
"template": """
|
| 256 |
Evaluate the extraction quality and information preservation in this converted document.
|
| 257 |
|