kleinhoellental commited on
Commit
5c152b2
1 Parent(s): aac19a4

Delete modules/gradio_testing.py

Browse files
Files changed (1) hide show
  1. modules/gradio_testing.py +0 -74
modules/gradio_testing.py DELETED
@@ -1,74 +0,0 @@
1
- # Import
2
- import geopandas as gpd
3
-
4
- # Sample DataFrame acording to actual structure (use your own data)
5
- data = {'GID_1': ['DEU.1_1','DEU.2_1'],
6
- 'GID_0': ['DEU', 'DEU'],
7
- 'COUNTRY': ['Germany', 'Germany'],
8
- 'NAME_1': ['Baden-Würtenberg', 'Bayern'],
9
- 'VARNAME_1': ['NA','Bavaria'],
10
- 'NL_NAME_1': ['NA', 'NA'],
11
- 'TYPE_1': ['Land', 'Freistaat'],
12
- 'ENGTYPE_1': ['State', 'Freestate'],
13
- 'CC_1': ['08','09'],
14
- 'HASC_1': ['DE.BW', 'DE.BY'], # Extra for subnational countys (https://de.wikipedia.org/wiki/Hierarchical_administrative_subdivision_codes)
15
- 'ISO_1': ['NA', 'DE-BY'], # International Order --> Check First (https://de.wikipedia.org/wiki/ISO_3166)
16
- 'geometry': [0,1]
17
- }
18
- gdf = gpd.GeoDataFrame(data)
19
-
20
-
21
- def getLand(landnr):
22
- landnr = int(landnr)
23
- #Test
24
- data = {'GID_1': ['DEU.1_1','DEU.2_1'],
25
- 'GID_0': ['DEU', 'DEU'],
26
- 'COUNTRY': ['Germany', 'Germany'],
27
- 'NAME_1': ['Baden-Würtenberg', 'Bayern'],
28
- 'VARNAME_1': ['NA','Bavaria'],
29
- 'NL_NAME_1': ['NA', 'NA'],
30
- 'TYPE_1': ['Land', 'Freistaat'],
31
- 'ENGTYPE_1': ['State', 'Freestate'],
32
- 'CC_1': ['08','09'],
33
- 'HASC_1': ['DE.BW', 'DE.BY'], # Extra for subnational countys (https://de.wikipedia.org/wiki/Hierarchical_administrative_subdivision_codes)
34
- 'ISO_1': ['NA', 'DE-BY'], # International Order --> Check First (https://de.wikipedia.org/wiki/ISO_3166)
35
- 'geometry': [0,1]
36
- }
37
- gdf = gpd.GeoDataFrame(data)
38
- landR = gdf.iloc[landnr]
39
- return landR
40
-
41
- # function to generate output
42
- # Land should be a line from the geojson-table
43
- # Currently only works for NUTS-1 areas!!!
44
-
45
- def getCountrycode(land, level = 1):
46
-
47
- iso = 'ISO_'+ str(level)
48
- hasc = 'HASC_' + str(level)
49
- if land[iso] != 'NA':
50
- return str(land[iso])
51
- elif land[hasc]:
52
- return str(land[hasc])
53
- else:
54
- return False
55
-
56
-
57
- def grad_Country(landnr):
58
- land = getLand(landnr)
59
- kuerzel = getCountrycode(land)
60
- return str(kuerzel)
61
-
62
-
63
- #'''
64
- import gradio as gr
65
-
66
- def greet(name):
67
- return "Hello " + name + "!!"
68
-
69
- iface = gr.Interface(fn=grad_Country, inputs="number", outputs="text")
70
-
71
- if __name__ == '__main__':
72
-
73
- iface.launch()
74
- #'''