Spaces:
Running
Running
broadfield
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -139,9 +139,9 @@ def parse_json(inp):
|
|
139 |
start = inp.find("```json") + 1 # Find index after the start character
|
140 |
end = inp.find("```", start) # Find index of end character from the start index
|
141 |
if start >= 0 and end >= 0:
|
142 |
-
|
143 |
else:
|
144 |
-
|
145 |
'''tog=False
|
146 |
cnt=0
|
147 |
for line in inp.split("\n"):
|
@@ -155,9 +155,9 @@ def parse_json(inp):
|
|
155 |
elif cnt==2:
|
156 |
tog = False'''
|
157 |
print("Extracted Lines")
|
158 |
-
print(
|
159 |
try:
|
160 |
-
out_json=eval(
|
161 |
out1=str(out_json['filename'])
|
162 |
out2=str(out_json['filecontent'])
|
163 |
return out1,out2
|
|
|
139 |
start = inp.find("```json") + 1 # Find index after the start character
|
140 |
end = inp.find("```", start) # Find index of end character from the start index
|
141 |
if start >= 0 and end >= 0:
|
142 |
+
inp= inp[start:end] # Slice the string between start and end
|
143 |
else:
|
144 |
+
inp="NONE" # Return None if characters not found
|
145 |
'''tog=False
|
146 |
cnt=0
|
147 |
for line in inp.split("\n"):
|
|
|
155 |
elif cnt==2:
|
156 |
tog = False'''
|
157 |
print("Extracted Lines")
|
158 |
+
print(inp)
|
159 |
try:
|
160 |
+
out_json=eval(inp)
|
161 |
out1=str(out_json['filename'])
|
162 |
out2=str(out_json['filecontent'])
|
163 |
return out1,out2
|