interviewer / app.py
IliaLarchenko's picture
Added problem generation
c8e8be4
raw
history blame
1.53 kB
import gradio as gr
from llm import get_problem
with gr.Blocks() as demo:
gr.Markdown("Your coding interview practice AI assistant!")
with gr.Tab("Coding"):
chat_history = gr.State([])
previous_code = gr.State("")
with gr.Accordion("Settings") as init_acc:
requirements = gr.Textbox(
label="Requirements",
placeholder=(
"Write any requirements here in a plain text: topic, difficulty, complexity, etc. "
"Or keep it blank to just get a random question."
),
)
start_btn = gr.Button("Start")
with gr.Accordion("Solution", open=True) as solution_acc:
with gr.Accordion("Problem description", open=True) as solution_acc:
description = gr.Markdown()
with gr.Row() as content:
with gr.Column(scale=2):
code = gr.Code(label="Solution", language="python", lines=20)
message = gr.Textbox(label="Message", lines=1)
answer_btn = gr.Button("Send message")
with gr.Column(scale=1):
chat = gr.Chatbot(label="Chat history")
end_btn = gr.Button("Finish the interview")
with gr.Accordion("Feedback", open=True) as feedback_acc:
feedback = gr.Markdown()
start_btn.click(fn=get_problem, inputs=requirements, outputs=[description, chat_history], scroll_to_output=True)
demo.launch()