Spaces:
Runtime error
Runtime error
Not tracking student name
Browse filesAdding steps to each button
app.py
CHANGED
@@ -4,14 +4,14 @@ import os
|
|
4 |
import shutil
|
5 |
import time
|
6 |
import traceback
|
7 |
-
import pandas as pd
|
8 |
-
import utils
|
9 |
|
10 |
import gradio as gr
|
|
|
11 |
from dotenv import load_dotenv
|
12 |
from langchain.chat_models import ChatOpenAI
|
13 |
from langchain.embeddings import OpenAIEmbeddings
|
14 |
|
|
|
15 |
from csv_agent import CSVAgent
|
16 |
from grader import Grader
|
17 |
from grader_qa import GraderQA
|
@@ -246,15 +246,13 @@ with gr.Blocks() as demo:
|
|
246 |
placeholder="Enter your Canvas API Key", type="password"
|
247 |
)
|
248 |
|
249 |
-
submit = gr.Button(value="Submit", variant="secondary", )
|
250 |
with gr.Row():
|
251 |
table = gr.Dataframe(label ='Canvas CSV Output', type="pandas", overflow_row_behaviour="paginate", visible = False, wrap=True)
|
252 |
|
253 |
-
|
254 |
with gr.Row():
|
255 |
-
|
256 |
-
|
257 |
-
download = gr.Button(value="Download", variant="secondary")
|
258 |
file = gr.components.File(label="CSV Output", container=False, visible=False).style(height=100)
|
259 |
reset = gr.ClearButton(value="Reset")
|
260 |
|
@@ -266,8 +264,8 @@ with gr.Blocks() as demo:
|
|
266 |
label="Ask questions about how students did on the discussion",
|
267 |
placeholder="Enter text and press enter, or upload an image", lines=1
|
268 |
)
|
|
|
269 |
upload = gr.UploadButton(label="Upload grading results", type="file", file_types=["csv"], scale=0.5)
|
270 |
-
ask = gr.Button(value="Ask", variant="secondary", scale=1)
|
271 |
|
272 |
chatbot.value = get_first_message([])
|
273 |
|
|
|
4 |
import shutil
|
5 |
import time
|
6 |
import traceback
|
|
|
|
|
7 |
|
8 |
import gradio as gr
|
9 |
+
import pandas as pd
|
10 |
from dotenv import load_dotenv
|
11 |
from langchain.chat_models import ChatOpenAI
|
12 |
from langchain.embeddings import OpenAIEmbeddings
|
13 |
|
14 |
+
import utils
|
15 |
from csv_agent import CSVAgent
|
16 |
from grader import Grader
|
17 |
from grader_qa import GraderQA
|
|
|
246 |
placeholder="Enter your Canvas API Key", type="password"
|
247 |
)
|
248 |
|
249 |
+
submit = gr.Button(value="Step 1: Submit", variant="secondary", )
|
250 |
with gr.Row():
|
251 |
table = gr.Dataframe(label ='Canvas CSV Output', type="pandas", overflow_row_behaviour="paginate", visible = False, wrap=True)
|
252 |
|
|
|
253 |
with gr.Row():
|
254 |
+
grade = gr.Button(value="Step 2: Grade", variant="secondary")
|
255 |
+
download = gr.Button(value="Step 3: View Grading Output", variant="secondary")
|
|
|
256 |
file = gr.components.File(label="CSV Output", container=False, visible=False).style(height=100)
|
257 |
reset = gr.ClearButton(value="Reset")
|
258 |
|
|
|
264 |
label="Ask questions about how students did on the discussion",
|
265 |
placeholder="Enter text and press enter, or upload an image", lines=1
|
266 |
)
|
267 |
+
ask = gr.Button(value="Step 4: Chat", variant="secondary", scale=1)
|
268 |
upload = gr.UploadButton(label="Upload grading results", type="file", file_types=["csv"], scale=0.5)
|
|
|
269 |
|
270 |
chatbot.value = get_first_message([])
|
271 |
|
ingest.py
CHANGED
@@ -1,11 +1,11 @@
|
|
|
|
1 |
import os
|
2 |
import re
|
3 |
-
import json
|
4 |
import shutil
|
|
|
5 |
|
6 |
import requests
|
7 |
from bs4 import BeautifulSoup
|
8 |
-
from typing import List
|
9 |
|
10 |
rubric = None
|
11 |
message = None
|
@@ -35,17 +35,19 @@ class DiscussionEntry:
|
|
35 |
|
36 |
def extract_entries(entries, participants):
|
37 |
result = []
|
|
|
38 |
for entry in entries:
|
39 |
if 'message' in entry and 'deleted' not in entry:
|
40 |
id = entry['id']
|
41 |
parent_id = entry['parent_id']
|
42 |
user_id = entry['user_id']
|
43 |
-
name = next((
|
44 |
message = entry['message']
|
45 |
replies = []
|
46 |
if 'replies' in entry:
|
47 |
replies = extract_entries(entry['replies'], participants)
|
48 |
result.append(DiscussionEntry(id, parent_id, name, message, replies))
|
|
|
49 |
return result
|
50 |
|
51 |
def save_messages(entries, group_id=None):
|
|
|
1 |
+
import json
|
2 |
import os
|
3 |
import re
|
|
|
4 |
import shutil
|
5 |
+
from typing import List
|
6 |
|
7 |
import requests
|
8 |
from bs4 import BeautifulSoup
|
|
|
9 |
|
10 |
rubric = None
|
11 |
message = None
|
|
|
35 |
|
36 |
def extract_entries(entries, participants):
|
37 |
result = []
|
38 |
+
counter = 0
|
39 |
for entry in entries:
|
40 |
if 'message' in entry and 'deleted' not in entry:
|
41 |
id = entry['id']
|
42 |
parent_id = entry['parent_id']
|
43 |
user_id = entry['user_id']
|
44 |
+
name = next((f"Student {counter}" for p in participants if p['id'] == user_id), None)
|
45 |
message = entry['message']
|
46 |
replies = []
|
47 |
if 'replies' in entry:
|
48 |
replies = extract_entries(entry['replies'], participants)
|
49 |
result.append(DiscussionEntry(id, parent_id, name, message, replies))
|
50 |
+
counter += 1
|
51 |
return result
|
52 |
|
53 |
def save_messages(entries, group_id=None):
|