drjieliu commited on
Commit
522c3e6
·
1 Parent(s): 31a18ba

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -6
app.py CHANGED
@@ -23,7 +23,7 @@ def atac_bwtonpz(atac_file):
23
 
24
  seq_length = length // 1000 * 1000
25
  signals[chr] = csr_matrix(temp.astype('float32')[:seq_length])
26
- with open('ATAC/atac_'+atac_file.replace('bigWig','pickle'),'wb') as f:
27
  pickle.dump(signals,f)
28
 
29
 
@@ -46,6 +46,7 @@ def process(bam_file,progress=gr.Progress()):
46
  else:
47
  progress(0.2, desc="Downloading BAM file "+bam_file)
48
  gdown.download(url=bam_file,fuzzy=True, output='ATAC/'+fid + '.bam')
 
49
  progress(0.4, desc="Index BAM file")
50
  time.sleep(0.1)
51
  pysam.index('ATAC/'+fid + '.bam')
@@ -60,10 +61,10 @@ def process(bam_file,progress=gr.Progress()):
60
  os.remove('ATAC/'+fid+'.bam.bai')
61
  os.remove('ATAC/'+fid + '.bigWig')
62
  os.remove('ATAC/'+fid + '.bam')
63
- return 'ATAC/atac_' + fid + '.pickle'
64
-
65
 
66
  css="li {font-size: 16px; --font: 'Quicksand', 'ui-sans-serif', 'system-ui', sans-serif"
 
67
  with gr.Blocks(css=css) as app:
68
  gr.HTML('<p>For faster inference without waiting in queue, you may duplicate the space. <a href="https://huggingface.co/spaces/drjieliu/epcot_app?duplicate=true">'
69
  '<img style="display: inline; margin-top: 0em; margin-bottom: 0em" src="https://bit.ly/3gLdBN6" alt="Duplicate Space" /></a></p>')
@@ -79,6 +80,4 @@ with gr.Blocks(css=css) as app:
79
  out = gr.File(label='Download the processed file')
80
  btn2.click(fn=process, inputs=inp, outputs=out)
81
 
82
-
83
-
84
- app.queue(concurrency_count=1,max_size=10).launch(enable_queue=True, debug=True)
 
23
 
24
  seq_length = length // 1000 * 1000
25
  signals[chr] = csr_matrix(temp.astype('float32')[:seq_length])
26
+ with open(atac_file.replace('bigWig','pickle'),'wb') as f:
27
  pickle.dump(signals,f)
28
 
29
 
 
46
  else:
47
  progress(0.2, desc="Downloading BAM file "+bam_file)
48
  gdown.download(url=bam_file,fuzzy=True, output='ATAC/'+fid + '.bam')
49
+
50
  progress(0.4, desc="Index BAM file")
51
  time.sleep(0.1)
52
  pysam.index('ATAC/'+fid + '.bam')
 
61
  os.remove('ATAC/'+fid+'.bam.bai')
62
  os.remove('ATAC/'+fid + '.bigWig')
63
  os.remove('ATAC/'+fid + '.bam')
64
+ return 'ATAC/'+fid + '.pickle'
 
65
 
66
  css="li {font-size: 16px; --font: 'Quicksand', 'ui-sans-serif', 'system-ui', sans-serif"
67
+ # theme=gr.themes.Monochrome(),css=css
68
  with gr.Blocks(css=css) as app:
69
  gr.HTML('<p>For faster inference without waiting in queue, you may duplicate the space. <a href="https://huggingface.co/spaces/drjieliu/epcot_app?duplicate=true">'
70
  '<img style="display: inline; margin-top: 0em; margin-bottom: 0em" src="https://bit.ly/3gLdBN6" alt="Duplicate Space" /></a></p>')
 
80
  out = gr.File(label='Download the processed file')
81
  btn2.click(fn=process, inputs=inp, outputs=out)
82
 
83
+ app.queue(concurrency_count=1,max_size=5).launch(enable_queue=True, debug=True)