File size: 1,041 Bytes
a1bf219
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
"""
Chart viewer component for displaying candlestick charts.
"""

from pathlib import Path
from typing import Optional

import gradio as gr


def create_chart_viewer() -> gr.Image:
    """
    Create chart viewer component.

    Returns:
        Gradio Image component for displaying charts
    """
    return gr.Image(
        label="Candlestick Chart",
        type="filepath",
        interactive=False,
        show_label=True,
    )


def display_chart(chart_path: Optional[str]) -> Optional[str]:
    """
    Prepare chart for display.

    Args:
        chart_path: Path to chart image

    Returns:
        Chart path if exists, None otherwise
    """
    if not chart_path:
        return None

    chart_file = Path(chart_path)

    if not chart_file.exists():
        return None

    return str(chart_file)


def create_placeholder_message() -> str:
    """
    Create placeholder message when no chart is available.

    Returns:
        Placeholder text
    """
    return "Chart will appear here after analysis completes..."