Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -21,14 +21,12 @@ def extract_text_from_pdf(pdf_file):
|
|
| 21 |
return text
|
| 22 |
|
| 23 |
def generate_summary(text):
|
| 24 |
-
response = openai.
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
{"role": "user", "content": f"Please summarize the following text: {text}"}
|
| 29 |
-
]
|
| 30 |
)
|
| 31 |
-
summary = response['choices'][0]['
|
| 32 |
return summary
|
| 33 |
|
| 34 |
def evaluate_text_against_rubric(rubric_text, text):
|
|
@@ -125,3 +123,4 @@ interface.launch()
|
|
| 125 |
|
| 126 |
|
| 127 |
|
|
|
|
|
|
| 21 |
return text
|
| 22 |
|
| 23 |
def generate_summary(text):
|
| 24 |
+
response = openai.Completion.create(
|
| 25 |
+
engine="text-davinci-003",
|
| 26 |
+
prompt=f"Please summarize the following text: {text}",
|
| 27 |
+
max_tokens=100
|
|
|
|
|
|
|
| 28 |
)
|
| 29 |
+
summary = response['choices'][0]['text'].strip()
|
| 30 |
return summary
|
| 31 |
|
| 32 |
def evaluate_text_against_rubric(rubric_text, text):
|
|
|
|
| 123 |
|
| 124 |
|
| 125 |
|
| 126 |
+
|