Label-studio: How to use local file on the tasks.json?

Created on 17 Sep 2019  路  9Comments  路  Source: heartexlabs/label-studio

Hi I'm trying to do audio classification but the files are too big to upload somewhere, plus it's sensitive data too. Is there a way to provide the url field locally on the tasks.json?

Thanks in advance

good first issue

Most helpful comment

If you place your file to label-studio/backend/static/data/1.wav then it will be available as http://localhost:8200/static/data/1.wav. Or you can make symlink to your data folder:

ln -s /my/data label-studio/backend/static/data

All 9 comments

Can you move you audio files over your hard disk? If you can place them nearby server.py, we will implement the fast solution.

Can you move you audio files over your hard disk? If you can place them nearby server.py, we will implement the fast solution.

Yes I can! What is the fast solution?

If you place your file to label-studio/backend/static/data/1.wav then it will be available as http://localhost:8200/static/data/1.wav. Or you can make symlink to your data folder:

ln -s /my/data label-studio/backend/static/data

@checker20 Did you manage to solve this issue? @makseq suggested a quick solution for you.

But need to do the correct support of local data and if you can make such functionality, then we will approve PR for community. 馃憤

I tried the suggested solution above with no success.

#config.xml
<View>
  <Header value="Choose text sentiment:"/>
  <Text name="my_text" value="$url"/>
  <Choices name="sentiment" toName="my_text" choice="single" showInLine="true">
    <Choice value="Positive"/>
    <Choice value="Negative"/>
    <Choice value="Neutral"/>
  </Choices>
</View>
#task.json
[{
    "url": "http://127.0.0.1:8200/static/file1.txt"
},
{
    "url": "http://127.0.0.1:8200/static/file2.txt"
}
]

This yield the following result:
Screenshot 2019-10-24 at 16 54 59

The file is correctly placed in backend/static/file*.txt. I also tried text key instead of url.

@maxpv
Currently, LS doesn't support .txt files, text format only:

[{
  "text": "Lorem.."
}]

Ok thanks for your answer, I came from #101

Hi.
I have similar problem.
I ran the server locally with this command.

label-studio start my-project -i sample-2020-01-22-09-10.json --init

and, in the json, I wrote like

[{"image": "000.png"}, 
{"image": "001.png"}, 
{"image": "002.png"}]

image
And I found this.

Where should i put the image?
I have put the image in cwd of label-studio start my-project ..., but it doesn't work.

According to the server log, I can assume that the error is about 'not found'(404).

Please help me to solve!
Thanks in advance.

Hi YongWookHa,

Label Studio doesn't support local file paths, but URLs. If you can't host somewhere your images or audio files for some reason, I suggest the following aforementioned workaround:

  1. Copy your files or make a symlink to static dir:
    bash ln -s my/dir/with/images label-studio/static/my_images
  2. Create your file.json with:
[
{"image": "http://localhost:8200/static/my_images/000.png"},
{"image": "http://localhost:8200/static/my_images/001.png"},
{"image": "http://localhost:8200/static/my_images/002.png"}
]
  1. Upload file.json via UI or start label-studio start my-project -i file.json --init
Was this page helpful?
0 / 5 - 0 ratings

Related issues

kgeis picture kgeis  路  4Comments

jthaloor picture jthaloor  路  4Comments

fakyras picture fakyras  路  3Comments

Rishabh-hyperverge picture Rishabh-hyperverge  路  3Comments

potipot picture potipot  路  4Comments