Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -5,6 +5,7 @@ import os
|
|
5 |
from openai import OpenAI
|
6 |
|
7 |
client = OpenAI(api_key=os.getenv('OPENAI_API_KEY'))
|
|
|
8 |
|
9 |
def process_excel_file(file_path, non_question_columns_str):
|
10 |
# Load the Excel file into a DataFrame
|
@@ -78,7 +79,7 @@ def grade_answer(question, participant_answer, key_answer):
|
|
78 |
|
79 |
|
80 |
response = client.completions.create(
|
81 |
-
model=
|
82 |
prompt=prompt,
|
83 |
max_tokens=1,
|
84 |
temperature=0,
|
@@ -98,7 +99,7 @@ iface = gr.Interface(
|
|
98 |
fn=process_and_grade,
|
99 |
inputs=[
|
100 |
gr.File(file_count="single", type="filepath"),
|
101 |
-
gr.Textbox(lines=2, placeholder="Column1, Column2, Column3, ...", label="Non-Question Columns"),
|
102 |
],
|
103 |
outputs=gr.File(label="Download Graded Results"),
|
104 |
title="Essay Question Grading",
|
@@ -106,4 +107,4 @@ iface = gr.Interface(
|
|
106 |
allow_flagging="never"
|
107 |
)
|
108 |
|
109 |
-
iface.launch()
|
|
|
5 |
from openai import OpenAI
|
6 |
|
7 |
client = OpenAI(api_key=os.getenv('OPENAI_API_KEY'))
|
8 |
+
model_ft_id = os.getenv('model_ft_id')
|
9 |
|
10 |
def process_excel_file(file_path, non_question_columns_str):
|
11 |
# Load the Excel file into a DataFrame
|
|
|
79 |
|
80 |
|
81 |
response = client.completions.create(
|
82 |
+
model=model_ft_id,
|
83 |
prompt=prompt,
|
84 |
max_tokens=1,
|
85 |
temperature=0,
|
|
|
99 |
fn=process_and_grade,
|
100 |
inputs=[
|
101 |
gr.File(file_count="single", type="filepath"),
|
102 |
+
gr.Textbox(lines=2, placeholder="Column1, Column2, Column3, ...", label="Non-Question Columns Like Nams, Id, etc."),
|
103 |
],
|
104 |
outputs=gr.File(label="Download Graded Results"),
|
105 |
title="Essay Question Grading",
|
|
|
107 |
allow_flagging="never"
|
108 |
)
|
109 |
|
110 |
+
iface.launch(share=True)
|