Last active
February 7, 2021 19:39
-
-
Save wesslen/9cded4be2f4610e5b15a9fa8ddfc47d3 to your computer and use it in GitHub Desktop.
Labelstudio + streamlit + docker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import streamlit as st | |
| from streamlit_labelstudio import st_labelstudio | |
| # from https://github.com/deneland/streamlit-labelstudio/blob/master/app.py | |
| st.set_page_config(layout='wide') | |
| config = """ | |
| <View> | |
| <Labels name="ner" toName="text"> | |
| <Label value="Person"></Label> | |
| <Label value="Organization"></Label> | |
| <Label value="Fact"></Label> | |
| <Label value="Money"></Label> | |
| <Label value="Date"></Label> | |
| <Label value="Time"></Label> | |
| <Label value="Ordinal"></Label> | |
| <Label value="Percent"></Label> | |
| <Label value="Product"></Label> | |
| <Label value="Language"></Label> | |
| <Label value="Location"></Label> | |
| </Labels> | |
| <Text name="text" value="$text"></Text> | |
| </View> | |
| """ | |
| interfaces = [ | |
| "panel", | |
| "update", | |
| "controls", | |
| "side-column", | |
| "completions:menu", | |
| "completions:add-new", | |
| "completions:delete", | |
| "predictions:menu", | |
| ], | |
| user = { | |
| 'pk': 1, | |
| 'firstName': "James", | |
| 'lastName': "Dean" | |
| }, | |
| task = { | |
| 'completions': [], | |
| 'predictions': [], | |
| 'id': 1, | |
| 'data': { | |
| 'text': "Charlotte is the most populous city in the U.S. state of North Carolina.", | |
| 'test': "Located in the Piedmont, it is the county seat of Mecklenburg County.", | |
| 'test': "In 2019, the U.S. Census Bureau estimated the population was 885,708, making it the 15th-most populous city in the U.S. and the second-largest in the Southeast behind Jacksonville, Florida.", | |
| 'test': "The city is the cultural, economic, and transportation center of the Charlotte metropolitan area, whose population ranks 22nd in the U.S., and had a population of 2,569,213, in 2018.", | |
| 'test': "The Charlotte metropolitan area is part of a sixteen-county market region or combined statistical area with a 2018 census-estimated population of 2,728,933." | |
| } | |
| } | |
| results_raw = st_labelstudio(config, interfaces, user, task) | |
| if results_raw is not None: | |
| st.table(results_raw) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM python:3.7 | |
| EXPOSE 8501 | |
| WORKDIR /app | |
| COPY requirements.txt ./requirements.txt | |
| RUN pip3 install -r requirements.txt | |
| COPY . . | |
| CMD streamlit run app.py |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| streamlit | |
| streamlit-labelstudio |
wesslen
commented
Feb 7, 2021
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment