Spaces:
Sleeping
Sleeping
zweiter versuch Dateien abzuspeichern und DL Links bereitzustellen
Browse files
app.py
CHANGED
@@ -24,8 +24,32 @@ def AskAI(ques, lv, table_main = table_main):
|
|
24 |
|
25 |
def AskAI_easy(ques):
|
26 |
Tmain = pd.read_csv('./data' + '/' + 'gadm41_DEU_1_main').astype(str)
|
|
|
|
|
27 |
blub = str(AskAI(ques,1,Tmain))
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
|
31 |
#######################################################################################
|
|
|
24 |
|
25 |
def AskAI_easy(ques):
|
26 |
Tmain = pd.read_csv('./data' + '/' + 'gadm41_DEU_1_main').astype(str)
|
27 |
+
Tgeom = pd.read_csv('./data' + '/' + 'gadm41_DEU_1_geom').astype(str)
|
28 |
+
fname = ''.join(char for char in str(ques) if char.isupper() or char.islower())
|
29 |
blub = str(AskAI(ques,1,Tmain))
|
30 |
+
|
31 |
+
row = eval(blub)[0]['coordinates'][0][0] #get object
|
32 |
+
out_df = Tmain.iloc[row,:12]
|
33 |
+
out_df['geom'] = Tgeom.iloc[row,1]
|
34 |
+
geojson_sting = out_df.to_json(orient='index')
|
35 |
+
#out_gdf = gpd.GeoDataFrame(out_df, geometry = 'geom') # funktioniert nicht --> Geometrie ist kaputt =(
|
36 |
+
#geojson_string = out_gdf.to_json(driver='GeoJSON')
|
37 |
+
|
38 |
+
# store File on GitHub
|
39 |
+
from github import Github
|
40 |
+
from github import Auth
|
41 |
+
github_user = "Giedeon25"
|
42 |
+
github_repo = "GID-Project"
|
43 |
+
token = "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"
|
44 |
+
# using an access token
|
45 |
+
auth = Auth.Token("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")
|
46 |
+
# First create a Github instance:
|
47 |
+
g = Github(auth=auth)
|
48 |
+
|
49 |
+
repo = g.get_repo("Giedeon25/GID-Project")
|
50 |
+
repo.create_file("data/Output/" + ques + ".json", "committing files", geojson_string, branch="main") # create File
|
51 |
+
|
52 |
+
return(blub + " ==== " + "dllink: https://github.com/Giedeon25/GID-Project/blob/main/data/Output/" + str(ques) + ".json")
|
53 |
|
54 |
|
55 |
#######################################################################################
|