Hell / app.py
midrees2806's picture
Update app.py
872e183 verified
raw
history blame contribute delete
890 Bytes
import gradio as gr
import json
from utils import get_best_answer
from dotenv import load_dotenv
# βœ… Load environment variables
load_dotenv()
# βœ… Load dataset
with open("ds.json", "r") as f:
dataset = json.load(f)
# βœ… Gradio UI Function
def chatbot_response(user_input):
try:
best_answer = get_best_answer(user_input)
return best_answer # βœ… Displays the rephrased best answer
except Exception as e:
return "Oops! Something went wrong. Please try again."
# βœ… Gradio Interface
iface = gr.Interface(
fn=chatbot_response,
inputs="text",
outputs="text",
title="UOE Academic Chatbot",
description="Hello! πŸŽ“ Welcome to **Academic Navigator** – the university information assistant for UOE.\nI can answer your university-related questions, such as admissions, scholarships."
)
# βœ… Launch App
iface.launch(share=True)