Spaces:
Running
Running
Small bug in demo buttons.
Browse files- kta_orange.png +0 -0
- main.py +31 -2
kta_orange.png
ADDED
main.py
CHANGED
@@ -648,7 +648,7 @@ def get(session, example_id:int):
|
|
648 |
)
|
649 |
session_state_table.insert(session_obj)
|
650 |
|
651 |
-
return tl_html_results_and_feedback_area(session)
|
652 |
|
653 |
|
654 |
########## CLEAR FORM
|
@@ -908,6 +908,33 @@ def get_user_level(session):
|
|
908 |
########## MAIN PAGE
|
909 |
|
910 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
911 |
@rt("/")
|
912 |
def get(session):
|
913 |
if 'session_id' not in session:
|
@@ -926,12 +953,14 @@ def get(session):
|
|
926 |
auth_area = html_render_login_to_get_access_part(session) # might set some secrets here
|
927 |
|
928 |
title = Title('C code review for students')
|
|
|
929 |
preamble = [
|
930 |
auth_area,
|
931 |
H1("Evaluate your C code!"),
|
932 |
P("Enter your code in the textbox below and wait for answers."),
|
933 |
P("!! The data will be saved and maybe made public !!", style="background-color: #f0fff0;"),
|
934 |
P("Hint: Don't evaluate more than ~ 1000 LoC."),
|
|
|
935 |
]
|
936 |
|
937 |
input_area = tl_html_render_inputbox(session, target_html_id=HTML_RESULTS_AREA, region_html_id=HTML_SUBMIT_CODE_AREA)
|
@@ -939,7 +968,7 @@ def get(session):
|
|
939 |
results_feedback_area = tl_html_results_and_feedback_area(session, show_submit_form=False)
|
940 |
clear_area = render_clear_area(session_id, HTML_CLEAR_FORM)
|
941 |
# print(session)
|
942 |
-
return title, Main( *preamble, input_area, samples_area, results_feedback_area, clear_area)
|
943 |
|
944 |
|
945 |
serve()
|
|
|
648 |
)
|
649 |
session_state_table.insert(session_obj)
|
650 |
|
651 |
+
return tl_html_results_and_feedback_area(session), render_clear_area(session_id, HTML_CLEAR_FORM)
|
652 |
|
653 |
|
654 |
########## CLEAR FORM
|
|
|
908 |
########## MAIN PAGE
|
909 |
|
910 |
|
911 |
+
def render_blog_links():
|
912 |
+
|
913 |
+
blog = P("The story behind this demo is ",
|
914 |
+
A("on my blog ", href="https://visoft.ro/machine-learning/llm-success-keep-the-data-flywheel-spinning/2024/08/18/", target="_blank"))
|
915 |
+
code_srd = P("The code can be found in the ", A("Space repo.",
|
916 |
+
href="https://huggingface.co/datasets/ml-visoft/c-reviewer/tree/main", target="_blank"))
|
917 |
+
div = Div(blog, code_srd, style="font-size: 1.1em;")
|
918 |
+
return div
|
919 |
+
|
920 |
+
def render_kta():
|
921 |
+
|
922 |
+
kta = P("Facing a similar problem? Let's connect!")
|
923 |
+
areas = [
|
924 |
+
Area(shape="rect", coords="0,0,56,68", href="mailto:cristian@visoft.ro", alt="Mail", target="_blank"),
|
925 |
+
Area(shape="rect", coords="60,0,116,68", href="https://twitter.com/ml_visoft", alt="X"),
|
926 |
+
Area(shape="rect", coords="120,0,176,68", href="https://www.linkedin.com/in/cristianvicas/", alt="LinkedIn"),
|
927 |
+
Area(shape="rect", coords="180,0,236,68", href="https://github.com/cristi-zz", alt="GitHub"),
|
928 |
+
]
|
929 |
+
area_map = Map(*areas, name="kta-social-map")
|
930 |
+
img_kta = Img(src="kta_orange.png", width="243", height="68", usemap="#kta-social-map")
|
931 |
+
|
932 |
+
out_div = Div(kta, area_map, img_kta, style="font-size: 1.1em; margin-top: 30px;"
|
933 |
+
"width: 50%; margin: 0 auto;display: flex;"
|
934 |
+
"flex-direction: column;"
|
935 |
+
"justify-content: center; align-items: center;")
|
936 |
+
return out_div
|
937 |
+
|
938 |
@rt("/")
|
939 |
def get(session):
|
940 |
if 'session_id' not in session:
|
|
|
953 |
auth_area = html_render_login_to_get_access_part(session) # might set some secrets here
|
954 |
|
955 |
title = Title('C code review for students')
|
956 |
+
kta_social = render_kta()
|
957 |
preamble = [
|
958 |
auth_area,
|
959 |
H1("Evaluate your C code!"),
|
960 |
P("Enter your code in the textbox below and wait for answers."),
|
961 |
P("!! The data will be saved and maybe made public !!", style="background-color: #f0fff0;"),
|
962 |
P("Hint: Don't evaluate more than ~ 1000 LoC."),
|
963 |
+
render_blog_links()
|
964 |
]
|
965 |
|
966 |
input_area = tl_html_render_inputbox(session, target_html_id=HTML_RESULTS_AREA, region_html_id=HTML_SUBMIT_CODE_AREA)
|
|
|
968 |
results_feedback_area = tl_html_results_and_feedback_area(session, show_submit_form=False)
|
969 |
clear_area = render_clear_area(session_id, HTML_CLEAR_FORM)
|
970 |
# print(session)
|
971 |
+
return title, Main( *preamble, input_area, samples_area, results_feedback_area, clear_area, kta_social)
|
972 |
|
973 |
|
974 |
serve()
|