Update app.py
Browse files
app.py
CHANGED
|
@@ -11,10 +11,10 @@ from code_editor import code_editor
|
|
| 11 |
|
| 12 |
lang_map = {
|
| 13 |
"Python": ["python", "python", "# Don't Worry, You Can't Break It. We Promise.\nprint('Hello World')\n"],
|
| 14 |
-
"CPP": ["
|
| 15 |
"Java": ["java", "java", "// Don't Worry, You Can't Break It. We Promise.\nclass HelloWorld {\n public static void main(String[] args) {\n System.out.println(\"Hello, World!\"); \n }\n}\n"],
|
| 16 |
"JavaScript": ["javascript", "javascript", "// Don't Worry, You Can't Break It. We Promise.\nconsole.log('Hello World!');\n"],
|
| 17 |
-
"Golang": ["
|
| 18 |
"Ruby": ["ruby", "ruby", "# Don't Worry, You Can't Break It. We Promise.\nputs 'Hello World'\n"],
|
| 19 |
"Rust": ["rust", "rust", "// Don't Worry, You Can't Break It. We Promise.\nfn main() {\n\tprintln!('Hello World!'); \n}\n"],
|
| 20 |
}
|
|
@@ -40,7 +40,8 @@ st.write("[UPDATE] Hosting the service is costly, so I’ve enabled the spot ins
|
|
| 40 |
|
| 41 |
# Language
|
| 42 |
lang = st.selectbox("Language?", lang_map.keys(), help="the language for submission.")
|
| 43 |
-
|
|
|
|
| 44 |
|
| 45 |
# Libraries
|
| 46 |
lib_str = st.text_input("Library?", placeholder="Package A, Package B, ... , Package N", help="if any libraries are needed. Seperate with a comma.")
|
|
@@ -63,7 +64,7 @@ editor_buttons = [{
|
|
| 63 |
"style": {"bottom": "0.44rem","right": "0.4rem"}
|
| 64 |
}]
|
| 65 |
code_prompt = lang_map[lang][2]
|
| 66 |
-
response_dict = code_editor(code_prompt, lang=
|
| 67 |
|
| 68 |
if response_dict['type'] == 'submit':
|
| 69 |
code = response_dict['text']
|
|
|
|
| 11 |
|
| 12 |
lang_map = {
|
| 13 |
"Python": ["python", "python", "# Don't Worry, You Can't Break It. We Promise.\nprint('Hello World')\n"],
|
| 14 |
+
"CPP": ["c_cpp", "cpp", "// Don't Worry, You Can't Break It. We Promise.\n// For Cpp, please make sure the program lasts at least 1 ms.\n#include <iostream>\nusing namespace std;\nint main() {\n\tcout << 'Hello World';\t\nreturn 0;\n}\n"],
|
| 15 |
"Java": ["java", "java", "// Don't Worry, You Can't Break It. We Promise.\nclass HelloWorld {\n public static void main(String[] args) {\n System.out.println(\"Hello, World!\"); \n }\n}\n"],
|
| 16 |
"JavaScript": ["javascript", "javascript", "// Don't Worry, You Can't Break It. We Promise.\nconsole.log('Hello World!');\n"],
|
| 17 |
+
"Golang": ["golang", "go", "// Don't Worry, You Can't Break It. We Promise.\npackage main\nimport 'fmt'\nfunc main() {\n\tfmt.Println('hello world')\n}\n"],
|
| 18 |
"Ruby": ["ruby", "ruby", "# Don't Worry, You Can't Break It. We Promise.\nputs 'Hello World'\n"],
|
| 19 |
"Rust": ["rust", "rust", "// Don't Worry, You Can't Break It. We Promise.\nfn main() {\n\tprintln!('Hello World!'); \n}\n"],
|
| 20 |
}
|
|
|
|
| 40 |
|
| 41 |
# Language
|
| 42 |
lang = st.selectbox("Language?", lang_map.keys(), help="the language for submission.")
|
| 43 |
+
editor_language = lang_map[lang][0]
|
| 44 |
+
monolith_language = lang_map[lang][1]
|
| 45 |
|
| 46 |
# Libraries
|
| 47 |
lib_str = st.text_input("Library?", placeholder="Package A, Package B, ... , Package N", help="if any libraries are needed. Seperate with a comma.")
|
|
|
|
| 64 |
"style": {"bottom": "0.44rem","right": "0.4rem"}
|
| 65 |
}]
|
| 66 |
code_prompt = lang_map[lang][2]
|
| 67 |
+
response_dict = code_editor(code_prompt, lang=monolith_language, height=[15,15], options={"wrap": False}, buttons=editor_buttons)
|
| 68 |
|
| 69 |
if response_dict['type'] == 'submit':
|
| 70 |
code = response_dict['text']
|