Blair Yang commited on
Commit
7e3fbab
1 Parent(s): ae6a8c0
Files changed (2) hide show
  1. app.py +29 -4
  2. flagged/log.csv +18 -0
app.py CHANGED
@@ -1,7 +1,32 @@
1
  import gradio as gr
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
 
5
 
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- iface.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
 
3
+ def evaluate_guess(reasoning, correctness, confidence):
4
+ # Placeholder function to process the input and return a response
5
+ return "Your evaluation has been recorded!"
6
 
7
+
8
+
9
+ card = 'Evaluation Card:\nNewtonian Mechanics\n\nQuestion: A block is pushed across a frictionless surface. What is the net force acting on the block?\n\nReasoning: The block is moving at a constant velocity, so the net force must be zero.\n\nCorrectness: Correct\n\nConfidence: 8/10\n\nEvaluation Output: Your evaluation has been recorded!'
10
+
11
+ with gr.Blocks() as app:
12
+ with gr.Row():
13
+ with gr.Column(scale=1):
14
+ evaluation_card_html = f"""
15
+ <div style='overflow-y: scroll; height: 200px; border: 1px solid #ccc; padding: 8px;'>
16
+ <h3>Student Evaluation</h3>
17
+ <p>Grade: A+</p>
18
+ <p>Card{card}</p>
19
+ </div>
20
+ """
21
+ gr.HTML(value=evaluation_card_html)
22
+ with gr.Column(scale=1):
23
+ question = gr.Textbox(lines=2, placeholder="Question", interactive=False)
24
+ reasoning = gr.Textbox(lines=5, placeholder="Your reasoning (optional)")
25
+ correctness = gr.Radio(choices=["Correct", "Incorrect"], label="I believe the model will answer this question")
26
+ confidence = gr.Slider(minimum=0, maximum=10, step=1, label="Confidence")
27
+ output_text = gr.Text(label="Evaluation Output") # Create an output text component
28
+ submit_button = gr.Button("Submit")
29
+
30
+ submit_button.click(evaluate_guess, inputs=[reasoning, correctness, confidence], outputs=output_text) # Use the output component
31
+
32
+ app.launch()
flagged/log.csv ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ reasoning,correctness,confidence,I believe the model will answer this question,Confidence,output,flag,username,timestamp
2
+ "'
3
+ <div style='overflow-y: scroll; height: 100px; border: 1px solid #ccc; padding: 8px;'>
4
+ <!-- Convert your Markdown to HTML and place it here -->
5
+ <h3>Student Evaluation</h3>
6
+ <p>Grade: A+</p>
7
+ <p>Comments: Excellent performance throughout the semester.</p>
8
+ </div>
9
+ ",,,,0,,,,2024-02-12 12:00:51.447583
10
+ "'
11
+ <div style='overflow-y: scroll; height: 100px; border: 1px solid #ccc; padding: 8px;'>
12
+ <!-- Convert your Markdown to HTML and place it here -->
13
+ <h3>Student Evaluation</h3>
14
+ <p>Grade: A+</p>
15
+ <p>Comments: Excellent performance throughout the semester.</p>
16
+ </div>
17
+ ",,,Correct,0,,,,2024-02-12 12:01:17.774597
18
+ ,,fff,,0,,,,2024-02-12 12:01:29.165206