File size: 670 Bytes
0eb79a8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# %%
from gradio_client import Client
import obspy
import numpy as np
import json
import pandas as pd

# %%

waveform = obspy.read()
array = np.array([x.data for x in waveform]).T

# pipeline = PreTrainedPipeline()
inputs = array.tolist()
inputs = json.dumps(inputs)
# picks = pipeline(inputs)
# print(picks)

# %%
client = Client("ai4eps/phasenet") 
output, file = client.predict(["test_test.mseed"])
# %%
with open(output, "r") as f:
    picks = json.load(f)["data"]

# %%
picks = pd.read_csv(file)


# %%
job = client.submit(["test_test.mseed", "test_test.mseed"], api_name="/predict")  # This is not blocking

print(job.status())

# %%
output, file = job.result()