Gateston Johns
remove key
2159718
raw
history blame
No virus
2.04 kB
import gradio as gr
from typing import Dict, Union, List
import json
import uuid
from storage.neo4j_dao import Neo4jDomainDAO
from domain.chunk_d import DocumentD, ChunkD
from query_pipeline.thesis_extractor import ThesisExtractor
from query_pipeline.evaluation_engine import EvaluationEngine
from proto.chunk_pb2 import Chunk, ChunkType
from datetime import datetime
import os
os.environ['NEO4J_USER'] = "neo4j"
os.environ['NEO4J_PASSWORD'] = "dOIZwzF_GImgwjF-smChe60QGQgicq8ER8RUlZvornU"
os.environ['NEO4J_URI'] = "neo4j+s://2317ae21.databases.neo4j.io"
def thesis_evaluation(thesis: str) -> str:
thesis_document_d = DocumentD(file_path="",
authors="user",
publish_date="2024-06-18")
thesis_chunk_d = ChunkD(chunk_text=thesis,
chunk_type=ChunkType.CHUNK_TYPE_PAGE,
chunk_index=0,
parent_reference=thesis_document_d)
thesis_entity_kg = ThesisExtractor().extract_relationships(thesis_chunk_d)
with Neo4jDomainDAO() as neo4j_dao:
full_db_kg = neo4j_dao.get_knowledge_graph()
return EvaluationEngine(full_db_kg).evaluate_and_display_thesis(thesis_entity_kg)
theme = gr.themes.Soft(
primary_hue="cyan",
secondary_hue="green",
neutral_hue="slate",
)
with gr.Blocks(theme=theme) as demo:
gr.HTML("""
<div style="background-color: rgb(171, 188, 251);">
<div style="background-color: rgb(151, 168, 231); padding-top: 2px; padding-bottom: 7px; text-align: center;">
<h1>AthenaAIC MetisLLM Thesis Evaluation Tool</h1>
</div>
</div>""")
with gr.Row():
inp = gr.Textbox(placeholder="What is your thesis?", scale=3, lines=3, show_label=False)
submit = gr.Button(scale=1, value="Evaluate")
with gr.Row():
out = gr.HTML()
submit.click(thesis_evaluation, inputs=inp, outputs=out)
demo.launch(
auth=('athena-admin', 'athena'),
share=True
)