Update app.py
Browse files
app.py
CHANGED
|
@@ -128,10 +128,10 @@ def load_file_content_backend(token, repo_id, repo_type, filepath):
|
|
| 128 |
|
| 129 |
ext = os.path.splitext(filepath)[1].lstrip('.').lower()
|
| 130 |
lang_map = {'py': 'python', 'js': 'javascript', 'md': 'markdown'}
|
| 131 |
-
language = lang_map.get(ext, '
|
| 132 |
return content, language
|
| 133 |
except Exception as e:
|
| 134 |
-
return f"Error loading file: {e}", '
|
| 135 |
|
| 136 |
def load_file_content_for_editor(token, repo_id, repo_type, filepath):
|
| 137 |
"""Gradio wrapper to update the code editor when a file is selected."""
|
|
|
|
| 128 |
|
| 129 |
ext = os.path.splitext(filepath)[1].lstrip('.').lower()
|
| 130 |
lang_map = {'py': 'python', 'js': 'javascript', 'md': 'markdown'}
|
| 131 |
+
language = lang_map.get(ext, 'python')
|
| 132 |
return content, language
|
| 133 |
except Exception as e:
|
| 134 |
+
return f"Error loading file: {e}", 'python'
|
| 135 |
|
| 136 |
def load_file_content_for_editor(token, repo_id, repo_type, filepath):
|
| 137 |
"""Gradio wrapper to update the code editor when a file is selected."""
|