Spaces:
Build error
Build error
Commit
·
92a0a4b
1
Parent(s):
901b0c1
Update app.py
Browse files
app.py
CHANGED
|
@@ -46,29 +46,30 @@ with gr.Blocks() as demo:
|
|
| 46 |
api_input = os.environ.get("OPENAI_API_KEY")
|
| 47 |
embed_key(api_input, study_tutor)
|
| 48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
with gr.Tab("Instructor Only"):
|
| 50 |
file_input = gr.Files(label="Load a .txt or .pdf file",
|
| 51 |
file_types=['.pdf', '.txt'], type="file",
|
| 52 |
elem_classes="short-height")
|
| 53 |
-
|
| 54 |
-
# Chatbot interface
|
| 55 |
-
gr.Markdown("""
|
| 56 |
-
## Chat with the Model
|
| 57 |
-
Description here
|
| 58 |
-
""")
|
| 59 |
-
|
| 60 |
-
with gr.Row(equal_height=True):
|
| 61 |
-
with gr.Column(scale=2):
|
| 62 |
-
chatbot = gr.Chatbot()
|
| 63 |
-
with gr.Row():
|
| 64 |
-
user_chat_input = gr.Textbox(label="User input", scale=9)
|
| 65 |
-
user_chat_submit = gr.Button("Ask/answer model", scale=1)
|
| 66 |
|
| 67 |
-
user_chat_submit.click(add_user_message,
|
| 68 |
-
[user_chat_input, study_tutor],
|
| 69 |
-
[chatbot, study_tutor], queue=False).then(
|
| 70 |
-
get_tutor_reply, [user_chat_input, study_tutor], [user_chat_input, chatbot, study_tutor], queue=True)
|
| 71 |
-
|
| 72 |
# Testing purpose
|
| 73 |
test_btn = gr.Button("View your chat history")
|
| 74 |
chat_history = gr.JSON(label = "conversation history")
|
|
|
|
| 46 |
api_input = os.environ.get("OPENAI_API_KEY")
|
| 47 |
embed_key(api_input, study_tutor)
|
| 48 |
|
| 49 |
+
with gr.Tab("For Students"):
|
| 50 |
+
# Chatbot interface
|
| 51 |
+
gr.Markdown("""
|
| 52 |
+
## Chat with the Model
|
| 53 |
+
Description here
|
| 54 |
+
""")
|
| 55 |
+
|
| 56 |
+
with gr.Row(equal_height=True):
|
| 57 |
+
with gr.Column(scale=2):
|
| 58 |
+
chatbot = gr.Chatbot()
|
| 59 |
+
with gr.Row():
|
| 60 |
+
user_chat_input = gr.Textbox(label="User input", scale=9)
|
| 61 |
+
user_chat_submit = gr.Button("Ask/answer model", scale=1)
|
| 62 |
+
|
| 63 |
+
user_chat_submit.click(add_user_message,
|
| 64 |
+
[user_chat_input, study_tutor],
|
| 65 |
+
[chatbot, study_tutor], queue=False).then(
|
| 66 |
+
get_tutor_reply, [user_chat_input, study_tutor], [user_chat_input, chatbot, study_tutor], queue=True)
|
| 67 |
+
|
| 68 |
with gr.Tab("Instructor Only"):
|
| 69 |
file_input = gr.Files(label="Load a .txt or .pdf file",
|
| 70 |
file_types=['.pdf', '.txt'], type="file",
|
| 71 |
elem_classes="short-height")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
# Testing purpose
|
| 74 |
test_btn = gr.Button("View your chat history")
|
| 75 |
chat_history = gr.JSON(label = "conversation history")
|