Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import openai
|
2 |
+
import gradio as gr
|
3 |
+
import random
|
4 |
+
import time
|
5 |
+
import os
|
6 |
+
|
7 |
+
openai.api_key = os.environ["API_KEY"]
|
8 |
+
|
9 |
+
messages = [
|
10 |
+
{"role": "system", "content": "You are helpful AI specialized in providing Job Interview Questions. Your name is ORABOT. Provide questions in different categories: behavioral, communications, opinion, performance-based, and technical. Refuse to answer anything other than providing job interview questions."},
|
11 |
+
]
|
12 |
+
|
13 |
+
def chatbot(input):
|
14 |
+
if input:
|
15 |
+
messages.append({"role": "user", "content": input})
|
16 |
+
chat = openai.ChatCompletion.create(
|
17 |
+
model="gpt-3.5-turbo", messages=messages
|
18 |
+
)
|
19 |
+
reply = chat.choices[0].message.content
|
20 |
+
messages.append({"role": "assistant", "content": reply})
|
21 |
+
return reply
|
22 |
+
|
23 |
+
inputs = gr.inputs.Textbox(lines=7, label="Paste Job Description in the box below")
|
24 |
+
outputs = gr.outputs.Textbox(label="Job Interview Questions")
|
25 |
+
|
26 |
+
gr.Interface(fn=chatbot, inputs=inputs, outputs=outputs, title="MDR Job Interview Questions Generator",
|
27 |
+
description="Paste Job Description in the box and I will provide job interview questions",
|
28 |
+
theme="panel",).launch()
|