Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -175,7 +175,7 @@ def build_space(repo_name,file_name,file_content,access_token=""):
|
|
175 |
)
|
176 |
|
177 |
local_file_path=str(uuid.uuid4())
|
178 |
-
with open(
|
179 |
f.write(str(file_content).strip("''").strip('""').strip("{}").format())
|
180 |
f.close()
|
181 |
# Upload a local file to the Space
|
@@ -266,7 +266,10 @@ def agent(prompt_in,history,mod=2,tok_in=""):
|
|
266 |
|
267 |
elif 'READ_FILE' in fn:
|
268 |
try:
|
269 |
-
|
|
|
|
|
|
|
270 |
except Exception as e:
|
271 |
print(e)
|
272 |
file_read="FILE HAS NO CONTENT"
|
|
|
175 |
)
|
176 |
|
177 |
local_file_path=str(uuid.uuid4())
|
178 |
+
with open(file_name, 'w') as f:
|
179 |
f.write(str(file_content).strip("''").strip('""').strip("{}").format())
|
180 |
f.close()
|
181 |
# Upload a local file to the Space
|
|
|
266 |
|
267 |
elif 'READ_FILE' in fn:
|
268 |
try:
|
269 |
+
with open(f'{com}', 'r') as f:
|
270 |
+
file_read = f.read()
|
271 |
+
f.close()
|
272 |
+
#file_read = fs.read_text(f'spaces/{user_}{repo_}/{com.strip("./")}',detail=False)
|
273 |
except Exception as e:
|
274 |
print(e)
|
275 |
file_read="FILE HAS NO CONTENT"
|