Update app.py
Browse files
app.py
CHANGED
@@ -451,27 +451,27 @@ def compute_tfidf_embeddings(documents1, documents2):
|
|
451 |
|
452 |
import requests
|
453 |
import base64
|
454 |
-
def extract_eval(
|
455 |
# print(image1)
|
456 |
-
# ideal_text=extract(
|
457 |
# print("Extracting Ideal Text \n")
|
458 |
# print(ideal_text)
|
459 |
-
# submitted_text=extract(
|
460 |
# print("Extracting Submitted Text \n")
|
461 |
# print(submitted_text)
|
462 |
# a,b=sim(ideal_text,submitted_text)
|
463 |
# print(a)
|
464 |
# text_sim_score=b
|
465 |
model = ResNet50(include_top=False, weights='imagenet', pooling='avg')
|
466 |
-
diagram_1_embed=return_image_embedding(model,
|
467 |
-
diagram_2_embed=return_image_embedding(model,
|
468 |
diagram_embed_sim_score=util.pytorch_cos_sim(diagram_1_embed, diagram_2_embed)
|
469 |
print("Diagram Embedding Similarity Score \n")
|
470 |
print(str(int(float(str(diagram_embed_sim_score).split("[")[2].split("]")[0])*10.0)))
|
471 |
-
diagram_1_text=inference(
|
472 |
-
diagram_2_text=inference(
|
473 |
-
print(diagram_1_text)
|
474 |
-
print(
|
475 |
|
476 |
|
477 |
|
|
|
451 |
|
452 |
import requests
|
453 |
import base64
|
454 |
+
def extract_eval(Ideal_Answer_Text,Ideal_Answer_Diagram,Submitted_Answer_Text,Submitted_Answer_Diagram):
|
455 |
# print(image1)
|
456 |
+
# ideal_text=extract(Ideal_Answer_Text)
|
457 |
# print("Extracting Ideal Text \n")
|
458 |
# print(ideal_text)
|
459 |
+
# submitted_text=extract(Submitted_Answer_Text)
|
460 |
# print("Extracting Submitted Text \n")
|
461 |
# print(submitted_text)
|
462 |
# a,b=sim(ideal_text,submitted_text)
|
463 |
# print(a)
|
464 |
# text_sim_score=b
|
465 |
model = ResNet50(include_top=False, weights='imagenet', pooling='avg')
|
466 |
+
diagram_1_embed=return_image_embedding(model,Ideal_Answer_Diagram)
|
467 |
+
diagram_2_embed=return_image_embedding(model,Submitted_Answer_Diagram)
|
468 |
diagram_embed_sim_score=util.pytorch_cos_sim(diagram_1_embed, diagram_2_embed)
|
469 |
print("Diagram Embedding Similarity Score \n")
|
470 |
print(str(int(float(str(diagram_embed_sim_score).split("[")[2].split("]")[0])*10.0)))
|
471 |
+
diagram_1_text=inference(Ideal_Answer_Diagram,['en'])
|
472 |
+
diagram_2_text=inference(Submitted_Answer_Diagram,['en'])
|
473 |
+
print(pd.DataFrame(diagram_1_text[0])to_numpy())
|
474 |
+
print(pd.DataFrame(diagram_1_text[0])to_numpy())
|
475 |
|
476 |
|
477 |
|