Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
-
from transformers import pipeline
|
| 3 |
import fitz # PyMuPDF
|
| 4 |
|
| 5 |
# Load a summarization model from Hugging Face
|
|
@@ -36,18 +42,11 @@ def evaluate_text_against_rubric(rubric_text, text):
|
|
| 36 |
"Comment": f"Evaluation based on criterion: {criterion}",
|
| 37 |
"Example": summary
|
| 38 |
}
|
| 39 |
-
except PipelineException as e:
|
| 40 |
-
evaluations[f'Criteria {i+1}'] = {
|
| 41 |
-
"Criterion": criterion,
|
| 42 |
-
"Score": 0,
|
| 43 |
-
"Comment": f"Error during evaluation: {str(e)}",
|
| 44 |
-
"Example": ""
|
| 45 |
-
}
|
| 46 |
except Exception as e:
|
| 47 |
evaluations[f'Criteria {i+1}'] = {
|
| 48 |
"Criterion": criterion,
|
| 49 |
"Score": 0,
|
| 50 |
-
"Comment": f"
|
| 51 |
"Example": ""
|
| 52 |
}
|
| 53 |
|
|
@@ -103,3 +102,4 @@ with gr.Blocks() as interface:
|
|
| 103 |
interface.launch()
|
| 104 |
|
| 105 |
|
|
|
|
|
|
| 1 |
+
# Dependencies:
|
| 2 |
+
# gradio==3.3.1
|
| 3 |
+
# transformers==4.27.1
|
| 4 |
+
# torch==2.0.1
|
| 5 |
+
# pymupdf==1.21.1
|
| 6 |
+
|
| 7 |
import gradio as gr
|
| 8 |
+
from transformers import pipeline
|
| 9 |
import fitz # PyMuPDF
|
| 10 |
|
| 11 |
# Load a summarization model from Hugging Face
|
|
|
|
| 42 |
"Comment": f"Evaluation based on criterion: {criterion}",
|
| 43 |
"Example": summary
|
| 44 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
except Exception as e:
|
| 46 |
evaluations[f'Criteria {i+1}'] = {
|
| 47 |
"Criterion": criterion,
|
| 48 |
"Score": 0,
|
| 49 |
+
"Comment": f"Error during evaluation: {str(e)}",
|
| 50 |
"Example": ""
|
| 51 |
}
|
| 52 |
|
|
|
|
| 102 |
interface.launch()
|
| 103 |
|
| 104 |
|
| 105 |
+
|