UI improvements
Browse files
app.py
CHANGED
|
@@ -53,8 +53,7 @@ def run_edits(code):
|
|
| 53 |
|
| 54 |
# User Interface Part
|
| 55 |
|
| 56 |
-
|
| 57 |
-
demo = gr.Blocks(title=TITLE, theme=gr.themes.Default())
|
| 58 |
|
| 59 |
|
| 60 |
def render_instruction(mtd):
|
|
@@ -70,7 +69,7 @@ def render_instruction(mtd):
|
|
| 70 |
if mtd == "TA":
|
| 71 |
return gr.Textbox.update(
|
| 72 |
value='''
|
| 73 |
-
π« Query should be a direct instruction
|
| 74 |
π« Use numbers wherever possible, i.e use 2 instead of two
|
| 75 |
π« Example: Write the code to find 7th Fibonacci number.
|
| 76 |
''',
|
|
@@ -86,10 +85,16 @@ def render_instruction(mtd):
|
|
| 86 |
visible=True
|
| 87 |
)
|
| 88 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
|
| 90 |
with demo:
|
| 91 |
-
gr.
|
| 92 |
-
|
| 93 |
access_token = gr.Textbox(type="password", label="Hugging Face Access Token")
|
| 94 |
with gr.Row():
|
| 95 |
methods = gr.Dropdown(choices=['PAL', 'TA', 'MathPrompter'], value="PAL",interactive=True, label="Evaluation Strategies")
|
|
@@ -98,7 +103,7 @@ with demo:
|
|
| 98 |
instruction = gr.Textbox(label="Instructions", visible=True, interactive=False, value=render_instruction("PAL")['value'])
|
| 99 |
methods.change(fn=render_instruction, inputs=methods, outputs=instruction)
|
| 100 |
|
| 101 |
-
question_output = gr.Textbox(label="Answer", interactive=
|
| 102 |
code = gr.Code(language="python", interactive=False, label="Generated Code (Editable)")
|
| 103 |
submit_btn = gr.Button("Submit")
|
| 104 |
edit_btn = gr.Button("Run the edited code", visible=False)
|
|
|
|
| 53 |
|
| 54 |
# User Interface Part
|
| 55 |
|
| 56 |
+
demo = gr.Blocks(title="Reasoning with StarCoder π«", theme=gr.themes.Default())
|
|
|
|
| 57 |
|
| 58 |
|
| 59 |
def render_instruction(mtd):
|
|
|
|
| 69 |
if mtd == "TA":
|
| 70 |
return gr.Textbox.update(
|
| 71 |
value='''
|
| 72 |
+
π« Query should be a direct instruction or a question, try to provide much context as possible
|
| 73 |
π« Use numbers wherever possible, i.e use 2 instead of two
|
| 74 |
π« Example: Write the code to find 7th Fibonacci number.
|
| 75 |
''',
|
|
|
|
| 85 |
visible=True
|
| 86 |
)
|
| 87 |
|
| 88 |
+
description = '''
|
| 89 |
+
<h1 style="text-align: center; color: white; font-size: 40px;"><strong>Reasoning with <span style='color: #ff75b3;'> StarCoder π«</span></strong></h1>
|
| 90 |
+
<br />
|
| 91 |
+
<span style='color: white; font-size: 18px;'>This space is a playground for allowing users to interact with <a href="https://huggingface.co/bigcode/large-model" style="color: #ff75b3;">StarCoder</a> and assessing its reasoning capabilities.
|
| 92 |
+
User can select any of the evaluating strategies from the available ones <u>PAL</u>, <u>TA</u> and <u>MathPrompter</u> following with asking the query in English. The model generated code with respect to the selected strategy will be executed in the server and result is displayed.
|
| 93 |
+
In addition, the space enables users to edit the generated code and re-run it, providing a high degree of flexibility and customization in the solution process.</span>
|
| 94 |
+
'''
|
| 95 |
|
| 96 |
with demo:
|
| 97 |
+
gr.Markdown(description, interactive=False)
|
|
|
|
| 98 |
access_token = gr.Textbox(type="password", label="Hugging Face Access Token")
|
| 99 |
with gr.Row():
|
| 100 |
methods = gr.Dropdown(choices=['PAL', 'TA', 'MathPrompter'], value="PAL",interactive=True, label="Evaluation Strategies")
|
|
|
|
| 103 |
instruction = gr.Textbox(label="Instructions", visible=True, interactive=False, value=render_instruction("PAL")['value'])
|
| 104 |
methods.change(fn=render_instruction, inputs=methods, outputs=instruction)
|
| 105 |
|
| 106 |
+
question_output = gr.Textbox(label="Answer", interactive=True)
|
| 107 |
code = gr.Code(language="python", interactive=False, label="Generated Code (Editable)")
|
| 108 |
submit_btn = gr.Button("Submit")
|
| 109 |
edit_btn = gr.Button("Run the edited code", visible=False)
|