Spaces:
Runtime error
Runtime error
IronOneAILabs
commited on
Commit
•
f0ae82e
1
Parent(s):
947766a
add function to write xml file - ds
Browse filesadd function to write xml file and push to dataset repo
app.py
CHANGED
@@ -19,11 +19,7 @@ repo = Repository(
|
|
19 |
local_dir="data", clone_from=DATASET_REPO_URL, use_auth_token=HF_TOKEN
|
20 |
)
|
21 |
|
22 |
-
tree = ET.parse(DATA_FILE)
|
23 |
-
root = tree.getroot()
|
24 |
-
custom_questions_from_file = [qs.text for qs in root.findall('question')]
|
25 |
|
26 |
-
print("list of qs ",custom_questions_from_file)
|
27 |
|
28 |
def get_cpu_spec():
|
29 |
cpu_info = {}
|
@@ -92,10 +88,12 @@ def fetch_text(url, api_key):
|
|
92 |
|
93 |
|
94 |
# ===============================================================
|
95 |
-
tree = ET.parse(
|
96 |
root = tree.getroot()
|
97 |
custom_questions_from_file = [qs.text for qs in root.findall('question')]
|
98 |
|
|
|
|
|
99 |
question_list = [
|
100 |
"Which building did this happen ?",
|
101 |
"What is the name of the street where the event occurred ?",
|
@@ -251,13 +249,16 @@ with gr.Blocks() as app:
|
|
251 |
|
252 |
def save_qs(custom_question):
|
253 |
tree = ET.ElementTree()
|
254 |
-
tree.parse(
|
255 |
root = tree.getroot()
|
256 |
name_elem = ET.SubElement(root, 'question')
|
257 |
name_elem.text = custom_question
|
258 |
-
tree.write(
|
259 |
|
260 |
-
|
|
|
|
|
|
|
261 |
root = tree.getroot()
|
262 |
custom_questions_from_file = [qs.text for qs in root.findall('question')]
|
263 |
|
|
|
19 |
local_dir="data", clone_from=DATASET_REPO_URL, use_auth_token=HF_TOKEN
|
20 |
)
|
21 |
|
|
|
|
|
|
|
22 |
|
|
|
23 |
|
24 |
def get_cpu_spec():
|
25 |
cpu_info = {}
|
|
|
88 |
|
89 |
|
90 |
# ===============================================================
|
91 |
+
tree = ET.parse(DATA_FILE)
|
92 |
root = tree.getroot()
|
93 |
custom_questions_from_file = [qs.text for qs in root.findall('question')]
|
94 |
|
95 |
+
print("list of qs ",custom_questions_from_file)
|
96 |
+
|
97 |
question_list = [
|
98 |
"Which building did this happen ?",
|
99 |
"What is the name of the street where the event occurred ?",
|
|
|
249 |
|
250 |
def save_qs(custom_question):
|
251 |
tree = ET.ElementTree()
|
252 |
+
tree.parse(DATA_FILE)
|
253 |
root = tree.getroot()
|
254 |
name_elem = ET.SubElement(root, 'question')
|
255 |
name_elem.text = custom_question
|
256 |
+
tree.write(DATA_FILE)
|
257 |
|
258 |
+
commit_url = repo.push_to_hub()
|
259 |
+
print(commit_url)
|
260 |
+
|
261 |
+
tree = ET.parse(DATA_FILE)
|
262 |
root = tree.getroot()
|
263 |
custom_questions_from_file = [qs.text for qs in root.findall('question')]
|
264 |
|