Code Monkey home page Code Monkey logo

Comments (3)

rmarquet21 avatar rmarquet21 commented on June 22, 2024

Look at the example https://github.com/rmarquet21/streamlit-annotation-tools/blob/master/examples/example.py

You have here the format of parameter labels

def labeler_page():
    st.title("Text Labeling Tool")

    text = "Yesterday, at 3 PM, Emily Johnson and Michael Smith met at the Central Park in New York to discuss the merger between TechCorp and Global Solutions. The deal, worth approximately 500 million dollars, is expected to significantly impact the tech industry. Later, at 6 PM, they joined a conference call with the CEO of TechCorp, David Brown, who was in London for a technology summit. During the call, they discussed the market trends in Asia and Europe and planned for the next quarterly meeting, which is scheduled for January 15th, 2024, in Paris."

    labels = {
        "Personal names": [
            {"start": 20, "end": 33, "label": "Emily Johnson"},
            {"start": 38, "end": 51, "label": "Michael Smith"},
            {"start": 327, "end": 338, "label": "David Brown"},
        ],
        "Organizations": [
            {"start": 118, "end": 126, "label": "TechCorp"},
            {"start": 131, "end": 147, "label": "Global Solutions"},
        ],
        "Locations": [
            {"start": 63, "end": 75, "label": "Central Park"},
            {"start": 79, "end": 87, "label": "New York"},
            {"start": 351, "end": 357, "label": "London"},
            {"start": 436, "end": 440, "label": "Asia"},
            {"start": 445, "end": 451, "label": "Europe"},
            {"start": 542, "end": 547, "label": "Paris"},
        ],
        "Time": [
            {"start": 0, "end": 9, "label": "Yesterday"},
            {"start": 14, "end": 18, "label": "3 PM"},
            {"start": 265, "end": 269, "label": "6 PM"},
            {"start": 519, "end": 531, "label": "January 15th"},
            {"start": 533, "end": 537, "label": "2024"},
        ],
        "Money": [{"start": 179, "end": 198, "label": "500 million dollars"}],
    }

    labels = text_labeler(text, labels)

from streamlit-annotation-tools.

BillCM avatar BillCM commented on June 22, 2024

OK. Perhaps there is an opportunity to clarify the code doc here.

The labels input isn't a list as defined in the code. It's actually a Dict.

def text_labeler(text: str, labels=[], in_snake_case=False):
    """Create a new instance of "text_labeler".

    Parameters
    ----------
    text : str
        The text to be labeled

    labels : list

from streamlit-annotation-tools.

rmarquet21 avatar rmarquet21 commented on June 22, 2024

You're right, I'll take care of it.

from streamlit-annotation-tools.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.