From 8c6fdf8dfb65b977c2145835dc61114cb8bb72a5 Mon Sep 17 00:00:00 2001 From: Vansh Chugh <1shhmusic2002@gmail.com> Date: Tue, 21 Jul 2026 01:30:40 +0530 Subject: [PATCH] added HARPTextTrack for .txt support --- pyharp/core.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pyharp/core.py b/pyharp/core.py index 8fed9f9..24b2d1b 100644 --- a/pyharp/core.py +++ b/pyharp/core.py @@ -32,6 +32,11 @@ class HarpMidiTrack(HarpComponent): required: bool type: str = "midi_track" +@dataclass +class HarpTextTrack(HarpComponent): + required: bool + type: str = "text_track" + @dataclass class HarpSlider(HarpComponent): minimum: float @@ -124,6 +129,15 @@ def get_harp_component(gr_cmp: Component) -> HarpComponent: info=gr_cmp.info, required=gr_cmp.is_harp_required ) + elif isinstance(gr_cmp, gr.File) \ + and '.txt' in gr_cmp.file_types: + assert gr_cmp.type == "filepath", \ + f"File input must be of type filepath, not {gr_cmp.type}" + harp_cmp = HarpTextTrack( + label=gr_cmp.label, + info=gr_cmp.info, + required=gr_cmp.is_harp_required + ) elif isinstance(gr_cmp, gr.Slider): harp_cmp = HarpSlider( minimum=gr_cmp.minimum,