crimeacs commited on
Commit
5af4ad6
1 Parent(s): 1258a4a

changed apperance

Browse files
Files changed (2) hide show
  1. Gradio_app.ipynb +17 -136
  2. app.py +13 -3
Gradio_app.ipynb CHANGED
@@ -2,14 +2,14 @@
2
  "cells": [
3
  {
4
  "cell_type": "code",
5
- "execution_count": 83,
6
  "metadata": {},
7
  "outputs": [
8
  {
9
  "name": "stdout",
10
  "output_type": "stream",
11
  "text": [
12
- "Running on local URL: http://127.0.0.1:7923\n",
13
  "\n",
14
  "To create a public link, set `share=True` in `launch()`.\n"
15
  ]
@@ -17,7 +17,7 @@
17
  {
18
  "data": {
19
  "text/html": [
20
- "<div><iframe src=\"http://127.0.0.1:7923/\" width=\"100%\" height=\"500\" allow=\"autoplay; camera; microphone; clipboard-read; clipboard-write;\" frameborder=\"0\" allowfullscreen></iframe></div>"
21
  ],
22
  "text/plain": [
23
  "<IPython.core.display.HTML object>"
@@ -30,138 +30,9 @@
30
  "data": {
31
  "text/plain": []
32
  },
33
- "execution_count": 83,
34
  "metadata": {},
35
  "output_type": "execute_result"
36
- },
37
- {
38
- "name": "stdout",
39
- "output_type": "stream",
40
- "text": [
41
- "Starting to download inventory\n",
42
- "Finished downloading inventory\n",
43
- "Processing CI.CCC...\n",
44
- "Downloading waveform\n",
45
- "Skipping CI_CCC_2019-07-04T17:33:40.494920Z\n",
46
- "Processing CI.CLC...\n",
47
- "Processing CI.JRC2...\n",
48
- "Reading cached waveform\n",
49
- "Added CI.JRC2 to the list of waveforms\n",
50
- "Processing CI.LRL...\n",
51
- "Reading cached waveform\n",
52
- "Added CI.LRL to the list of waveforms\n",
53
- "Processing CI.MPM...\n",
54
- "Reading cached waveform\n",
55
- "Processing CI.Q0072...\n",
56
- "Reading cached waveform\n",
57
- "Processing CI.SLA...\n",
58
- "Reading cached waveform\n",
59
- "Added CI.SLA to the list of waveforms\n",
60
- "Processing CI.SRT...\n",
61
- "Reading cached waveform\n",
62
- "Added CI.SRT to the list of waveforms\n",
63
- "Processing CI.TOW2...\n",
64
- "Reading cached waveform\n",
65
- "Added CI.TOW2 to the list of waveforms\n",
66
- "Processing CI.WBM...\n",
67
- "Downloading waveform\n",
68
- "Skipping CI_WBM_2019-07-04T17:33:40.063616Z\n",
69
- "Processing CI.WCS2...\n",
70
- "Downloading waveform\n",
71
- "Skipping CI_WCS2_2019-07-04T17:33:40.200958Z\n",
72
- "Processing CI.WMF...\n",
73
- "Reading cached waveform\n",
74
- "Added CI.WMF to the list of waveforms\n",
75
- "Processing CI.WNM...\n",
76
- "Reading cached waveform\n",
77
- "Processing CI.WRC2...\n",
78
- "Downloading waveform\n",
79
- "Skipping CI_WRC2_2019-07-04T17:33:38.698099Z\n",
80
- "Processing CI.WRV2...\n",
81
- "Reading cached waveform\n",
82
- "Processing CI.WVP2...\n",
83
- "Downloading waveform\n",
84
- "Skipping CI_WVP2_2019-07-04T17:33:39.650402Z\n",
85
- "Processing NP.1809...\n",
86
- "Reading cached waveform\n",
87
- "Processing NP.5419...\n",
88
- "Reading cached waveform\n",
89
- "Processing PB.B916...\n",
90
- "Reading cached waveform\n",
91
- "Processing PB.B917...\n",
92
- "Reading cached waveform\n",
93
- "Processing PB.B918...\n",
94
- "Reading cached waveform\n",
95
- "Processing PB.B921...\n",
96
- "Reading cached waveform\n",
97
- "Starting to run predictions\n"
98
- ]
99
- },
100
- {
101
- "name": "stderr",
102
- "output_type": "stream",
103
- "text": [
104
- "/var/folders/_g/3q5q8_dj0ydcpktxlwxb5vrh0000gq/T/ipykernel_17878/2982466024.py:225: FutureWarning: The input object of type 'Tensor' is an array-like implementing one of the corresponding protocols (`__array__`, `__array_interface__` or `__array_struct__`); but not a sequence (or 0-D). In the future, this object will be coerced as if it was first converted using `np.array(obj)`. To retain the old behaviour, you have to either modify the type 'Tensor', or assign to an empty array created with `np.empty(correct_shape, dtype=object)`.\n",
105
- " waveforms = np.array(waveforms)[selection_indexes]\n",
106
- "/var/folders/_g/3q5q8_dj0ydcpktxlwxb5vrh0000gq/T/ipykernel_17878/2982466024.py:225: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray.\n",
107
- " waveforms = np.array(waveforms)[selection_indexes]\n",
108
- "/var/folders/_g/3q5q8_dj0ydcpktxlwxb5vrh0000gq/T/ipykernel_17878/2982466024.py:232: UserWarning: To copy construct from a tensor, it is recommended to use sourceTensor.clone().detach() or sourceTensor.clone().detach().requires_grad_(True), rather than torch.tensor(sourceTensor).\n",
109
- " waveforms = [torch.tensor(waveform) for waveform in waveforms]\n"
110
- ]
111
- },
112
- {
113
- "name": "stdout",
114
- "output_type": "stream",
115
- "text": [
116
- "Starting plotting 3 waveforms\n",
117
- "Fetching topography\n",
118
- "Plotting topo\n"
119
- ]
120
- },
121
- {
122
- "name": "stderr",
123
- "output_type": "stream",
124
- "text": [
125
- "/Users/anovosel/miniconda3/envs/phasehunter/lib/python3.11/site-packages/bmi_topography/api_key.py:49: UserWarning: You are using a demo key to fetch data from OpenTopography, functionality will be limited. See https://bmi-topography.readthedocs.io/en/latest/#api-key for more information.\n",
126
- " warnings.warn(\n"
127
- ]
128
- },
129
- {
130
- "name": "stdout",
131
- "output_type": "stream",
132
- "text": [
133
- "Plotting waveform 1/3\n",
134
- "Station 36.11758, -117.85486 has P velocity 4.96342368856812 and S velocity 3.0001093626503503\n",
135
- "Plotting waveform 2/3\n"
136
- ]
137
- },
138
- {
139
- "name": "stderr",
140
- "output_type": "stream",
141
- "text": [
142
- "/var/folders/_g/3q5q8_dj0ydcpktxlwxb5vrh0000gq/T/ipykernel_17878/2982466024.py:302: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.\n",
143
- " output_picks = output_picks.append(pd.DataFrame({'station_name': [names[i]], 'starttime' : [str(t0s[i])],\n"
144
- ]
145
- },
146
- {
147
- "name": "stdout",
148
- "output_type": "stream",
149
- "text": [
150
- "Station 35.98249, -117.80885 has P velocity 4.229153346955616 and S velocity 2.3118595983254937\n",
151
- "Plotting waveform 3/3\n",
152
- "Station 35.69235, -117.75051 has P velocity 2.9537452996413585 and S velocity 1.3863453902284213\n",
153
- "Plotting stations\n"
154
- ]
155
- },
156
- {
157
- "name": "stderr",
158
- "output_type": "stream",
159
- "text": [
160
- "/var/folders/_g/3q5q8_dj0ydcpktxlwxb5vrh0000gq/T/ipykernel_17878/2982466024.py:302: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.\n",
161
- " output_picks = output_picks.append(pd.DataFrame({'station_name': [names[i]], 'starttime' : [str(t0s[i])],\n",
162
- "/var/folders/_g/3q5q8_dj0ydcpktxlwxb5vrh0000gq/T/ipykernel_17878/2982466024.py:302: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.\n",
163
- " output_picks = output_picks.append(pd.DataFrame({'station_name': [names[i]], 'starttime' : [str(t0s[i])],\n"
164
- ]
165
  }
166
  ],
167
  "source": [
@@ -514,7 +385,16 @@
514
  "\n",
515
  "with gr.Blocks() as demo:\n",
516
  " gr.HTML(\"\"\"<h1>PhaseHunter</h1>\n",
517
- "<p>This app allows one to detect <mark style=\"background-color: red; color: white;\">P</mark> and <mark style=\"background-color: blue; color: white;\">S</mark> seismic phases along with <span style=\"background-image: linear-gradient(to right, #f12711, #f5af19); \n",
 
 
 
 
 
 
 
 
 
518
  " -webkit-background-clip: text;\n",
519
  " -webkit-text-fill-color: transparent;\n",
520
  " background-clip: text;\n",
@@ -527,8 +407,9 @@
527
  " <li>By selecting an earthquake from the global earthquake catalogue.</li>\n",
528
  "</ol>\n",
529
  "<p>Please upload your waveform in <code>.npy</code> (numpy) format.</p>\n",
530
- "<p>Your waveform should be sampled at 100 samples per second and have 3 (Z, N, E) or 1 (Z) channels. If your file is longer than 60 seconds, the app will only use the first 60 seconds of the waveform.</p>\n",
531
- " \"\"\")\n",
 
532
  " with gr.Tab(\"Try on a single station\"):\n",
533
  " with gr.Row(): \n",
534
  " # Define the input and output types for Gradio\n",
 
2
  "cells": [
3
  {
4
  "cell_type": "code",
5
+ "execution_count": 1,
6
  "metadata": {},
7
  "outputs": [
8
  {
9
  "name": "stdout",
10
  "output_type": "stream",
11
  "text": [
12
+ "Running on local URL: http://127.0.0.1:7860\n",
13
  "\n",
14
  "To create a public link, set `share=True` in `launch()`.\n"
15
  ]
 
17
  {
18
  "data": {
19
  "text/html": [
20
+ "<div><iframe src=\"http://127.0.0.1:7860/\" width=\"100%\" height=\"500\" allow=\"autoplay; camera; microphone; clipboard-read; clipboard-write;\" frameborder=\"0\" allowfullscreen></iframe></div>"
21
  ],
22
  "text/plain": [
23
  "<IPython.core.display.HTML object>"
 
30
  "data": {
31
  "text/plain": []
32
  },
33
+ "execution_count": 1,
34
  "metadata": {},
35
  "output_type": "execute_result"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  }
37
  ],
38
  "source": [
 
385
  "\n",
386
  "with gr.Blocks() as demo:\n",
387
  " gr.HTML(\"\"\"<h1>PhaseHunter</h1>\n",
388
+ "<p>This app allows uses a new neural network called PhaseHunter to detect <span style=\"background-image: linear-gradient(to right, #ED213A, #93291E); \n",
389
+ " -webkit-background-clip: text;\n",
390
+ " -webkit-text-fill-color: transparent;\n",
391
+ " background-clip: text;\n",
392
+ " font-size: 24px;\">P</span> and \n",
393
+ " <span style=\"background-image: linear-gradient(to right, #00B4DB, #0083B0); \n",
394
+ " -webkit-background-clip: text;\n",
395
+ " -webkit-text-fill-color: transparent;\n",
396
+ " background-clip: text;\n",
397
+ " font-size: 24px;\">S</span> seismic phases along with <span style=\"background-image: linear-gradient(to right, #f12711, #f5af19); \n",
398
  " -webkit-background-clip: text;\n",
399
  " -webkit-text-fill-color: transparent;\n",
400
  " background-clip: text;\n",
 
407
  " <li>By selecting an earthquake from the global earthquake catalogue.</li>\n",
408
  "</ol>\n",
409
  "<p>Please upload your waveform in <code>.npy</code> (numpy) format.</p>\n",
410
+ "<p>Your waveform should be sampled at 100 samples per second and have 3 (Z, N, E) or 1 (Z) channels. \n",
411
+ "If your file is longer than 60 seconds, the app will only use the first 60 seconds of the waveform.</p>\n",
412
+ "\"\"\")\n",
413
  " with gr.Tab(\"Try on a single station\"):\n",
414
  " with gr.Row(): \n",
415
  " # Define the input and output types for Gradio\n",
app.py CHANGED
@@ -347,7 +347,16 @@ model.eval()
347
 
348
  with gr.Blocks() as demo:
349
  gr.HTML("""<h1>PhaseHunter</h1>
350
- <p>This app allows one to detect <mark style="background-color: red; color: white;">P</mark> and <mark style="background-color: blue; color: white;">S</mark> seismic phases along with <span style="background-image: linear-gradient(to right, #f12711, #f5af19);
 
 
 
 
 
 
 
 
 
351
  -webkit-background-clip: text;
352
  -webkit-text-fill-color: transparent;
353
  background-clip: text;
@@ -360,8 +369,9 @@ with gr.Blocks() as demo:
360
  <li>By selecting an earthquake from the global earthquake catalogue.</li>
361
  </ol>
362
  <p>Please upload your waveform in <code>.npy</code> (numpy) format.</p>
363
- <p>Your waveform should be sampled at 100 samples per second and have 3 (Z, N, E) or 1 (Z) channels. If your file is longer than 60 seconds, the app will only use the first 60 seconds of the waveform.</p>
364
- """)
 
365
  with gr.Tab("Try on a single station"):
366
  with gr.Row():
367
  # Define the input and output types for Gradio
 
347
 
348
  with gr.Blocks() as demo:
349
  gr.HTML("""<h1>PhaseHunter</h1>
350
+ <p>This app allows uses a new neural network called PhaseHunter to detect <span style="background-image: linear-gradient(to right, #ED213A, #93291E);
351
+ -webkit-background-clip: text;
352
+ -webkit-text-fill-color: transparent;
353
+ background-clip: text;
354
+ font-size: 24px;">P</span> and
355
+ <span style="background-image: linear-gradient(to right, #00B4DB, #0083B0);
356
+ -webkit-background-clip: text;
357
+ -webkit-text-fill-color: transparent;
358
+ background-clip: text;
359
+ font-size: 24px;">S</span> seismic phases along with <span style="background-image: linear-gradient(to right, #f12711, #f5af19);
360
  -webkit-background-clip: text;
361
  -webkit-text-fill-color: transparent;
362
  background-clip: text;
 
369
  <li>By selecting an earthquake from the global earthquake catalogue.</li>
370
  </ol>
371
  <p>Please upload your waveform in <code>.npy</code> (numpy) format.</p>
372
+ <p>Your waveform should be sampled at 100 samples per second and have 3 (Z, N, E) or 1 (Z) channels.
373
+ If your file is longer than 60 seconds, the app will only use the first 60 seconds of the waveform.</p>
374
+ """)
375
  with gr.Tab("Try on a single station"):
376
  with gr.Row():
377
  # Define the input and output types for Gradio