Spaces:
Sleeping
Sleeping
Commit
·
b94ea39
1
Parent(s):
44d4654
Update app.py
Browse files
app.py
CHANGED
@@ -43,17 +43,17 @@ def get_list(disease):
|
|
43 |
advices = ast.literal_eval((data[data['diseases']==str(disease)]["Advices"]).iloc[0])
|
44 |
return sympto,investigations,drugs,advices
|
45 |
#------------------------------------------------
|
46 |
-
api = HfApi()
|
47 |
|
48 |
-
# Replace with your Hugging Face Spaces username and repository name
|
49 |
-
username = "Add-Vishnu"
|
50 |
-
repo_name = "cdss_kb_generation"
|
51 |
|
52 |
-
# Replace with the CSV file name
|
53 |
filename = "demo1.csv"
|
54 |
|
55 |
-
# Load the repository
|
56 |
-
repo = HfFolder.
|
57 |
#---------------------------------------------------------
|
58 |
def save_data(disease,symp_data,invest_data,drug_data,advice_data):
|
59 |
user = ""
|
@@ -62,13 +62,14 @@ def save_data(disease,symp_data,invest_data,drug_data,advice_data):
|
|
62 |
user = username
|
63 |
print("In save:",user)
|
64 |
# Read the existing content of the CSV file
|
65 |
-
file_path = repo.filename_to_path(filename)
|
66 |
existing_rows = []
|
67 |
-
with open(
|
68 |
-
print("
|
69 |
csv_reader = csv.reader(csv_file)
|
70 |
for row in csv_reader:
|
71 |
existing_rows.append(row)
|
|
|
72 |
try:
|
73 |
print("In try")
|
74 |
with open("./demo1.csv", mode="w", newline="") as csvfile:
|
|
|
43 |
advices = ast.literal_eval((data[data['diseases']==str(disease)]["Advices"]).iloc[0])
|
44 |
return sympto,investigations,drugs,advices
|
45 |
#------------------------------------------------
|
46 |
+
# api = HfApi()
|
47 |
|
48 |
+
# # Replace with your Hugging Face Spaces username and repository name
|
49 |
+
# username = "Add-Vishnu"
|
50 |
+
# repo_name = "cdss_kb_generation"
|
51 |
|
52 |
+
# # Replace with the CSV file name
|
53 |
filename = "demo1.csv"
|
54 |
|
55 |
+
# # Load the repository
|
56 |
+
# repo = HfFolder.(repo_name, api=api, username=username)
|
57 |
#---------------------------------------------------------
|
58 |
def save_data(disease,symp_data,invest_data,drug_data,advice_data):
|
59 |
user = ""
|
|
|
62 |
user = username
|
63 |
print("In save:",user)
|
64 |
# Read the existing content of the CSV file
|
65 |
+
# file_path = repo.filename_to_path(filename)
|
66 |
existing_rows = []
|
67 |
+
with open(filename, "r") as csv_file:
|
68 |
+
print("Reading the data")
|
69 |
csv_reader = csv.reader(csv_file)
|
70 |
for row in csv_reader:
|
71 |
existing_rows.append(row)
|
72 |
+
print(existing_rows)
|
73 |
try:
|
74 |
print("In try")
|
75 |
with open("./demo1.csv", mode="w", newline="") as csvfile:
|