Spaces:
Build error
Build error
Commit
•
1d415c1
1
Parent(s):
22fb546
Update app.py
Browse files
app.py
CHANGED
@@ -38,6 +38,7 @@ def predict(code_txt):
|
|
38 |
return with_omp_str if y_hat==1 else without_omp_str, torch.nn.Softmax(dim=1)(pred).squeeze()[y_hat].item()
|
39 |
|
40 |
|
|
|
41 |
def is_private(code_txt):
|
42 |
if predict(code_txt)[0] == without_omp_str:
|
43 |
return gr.update(visible=False)
|
@@ -55,7 +56,7 @@ def is_private(code_txt):
|
|
55 |
# if y_hat == 0:
|
56 |
# return gr.update(visible=False)
|
57 |
# else:
|
58 |
-
return gr.update(value=f"{'
|
59 |
|
60 |
|
61 |
def is_reduction(code_txt, label):
|
@@ -75,7 +76,7 @@ def is_reduction(code_txt, label):
|
|
75 |
# if y_hat == 0:
|
76 |
# return gr.update(visible=False)
|
77 |
# else:
|
78 |
-
return gr.update(value=f"{'
|
79 |
|
80 |
|
81 |
# Define GUI
|
@@ -96,7 +97,7 @@ with gr.Blocks() as pragformer_gui:
|
|
96 |
drop = gr.Dropdown(list(data.keys()), label="Mix of parallel and not-parallel code snippets", value="Minyoung-Kim1110/OpenMP/Excercise/atomic/0")
|
97 |
sample_btn = gr.Button("Sample")
|
98 |
|
99 |
-
pragma = gr.Textbox(label="Original
|
100 |
|
101 |
code_in = gr.Textbox(lines=5, label="Write some code and see if it should contain a parallel work-sharing loop construct")
|
102 |
submit_btn = gr.Button("Submit")
|
@@ -108,8 +109,8 @@ with gr.Blocks() as pragformer_gui:
|
|
108 |
confidence_out = gr.Textbox(label="Confidence")
|
109 |
|
110 |
with gr.Row():
|
111 |
-
private = gr.Textbox(label="
|
112 |
-
reduction = gr.Textbox(label="
|
113 |
|
114 |
submit_btn.click(fn=predict, inputs=code_in, outputs=[label_out, confidence_out])
|
115 |
submit_btn.click(fn=is_private, inputs=code_in, outputs=private)
|
|
|
38 |
return with_omp_str if y_hat==1 else without_omp_str, torch.nn.Softmax(dim=1)(pred).squeeze()[y_hat].item()
|
39 |
|
40 |
|
41 |
+
|
42 |
def is_private(code_txt):
|
43 |
if predict(code_txt)[0] == without_omp_str:
|
44 |
return gr.update(visible=False)
|
|
|
56 |
# if y_hat == 0:
|
57 |
# return gr.update(visible=False)
|
58 |
# else:
|
59 |
+
return gr.update(value=f"Should {'not' if y_hat==0 else ''} contain private with confidence: {torch.nn.Softmax(dim=1)(pred).squeeze()[y_hat].item()}", visible=True)
|
60 |
|
61 |
|
62 |
def is_reduction(code_txt, label):
|
|
|
76 |
# if y_hat == 0:
|
77 |
# return gr.update(visible=False)
|
78 |
# else:
|
79 |
+
return gr.update(value=f"Should {'not' if y_hat==0 else ''} contain reduction with confidence: {torch.nn.Softmax(dim=1)(pred).squeeze()[y_hat].item()}", visible=True)
|
80 |
|
81 |
|
82 |
# Define GUI
|
|
|
97 |
drop = gr.Dropdown(list(data.keys()), label="Mix of parallel and not-parallel code snippets", value="Minyoung-Kim1110/OpenMP/Excercise/atomic/0")
|
98 |
sample_btn = gr.Button("Sample")
|
99 |
|
100 |
+
pragma = gr.Textbox(label="Original parallelization classification (if any)")
|
101 |
|
102 |
code_in = gr.Textbox(lines=5, label="Write some code and see if it should contain a parallel work-sharing loop construct")
|
103 |
submit_btn = gr.Button("Submit")
|
|
|
109 |
confidence_out = gr.Textbox(label="Confidence")
|
110 |
|
111 |
with gr.Row():
|
112 |
+
private = gr.Textbox(label="Data-sharing attribute clause- private", visible=False)
|
113 |
+
reduction = gr.Textbox(label="Data-sharing attribute clause- reduction", visible=False)
|
114 |
|
115 |
submit_btn.click(fn=predict, inputs=code_in, outputs=[label_out, confidence_out])
|
116 |
submit_btn.click(fn=is_private, inputs=code_in, outputs=private)
|