RustX commited on
Commit
5edfa05
ยท
1 Parent(s): ae8ab71

Create layout.py

Browse files
Files changed (1) hide show
  1. modules/layout.py +42 -0
modules/layout.py ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+
3
+
4
+ class Layout:
5
+ def show_header(self):
6
+ """
7
+ Displays the header of the app
8
+ """
9
+ st.markdown(
10
+ """
11
+ <h1 style='text-align: center;'>CSV-ChatBot, Talk with your csv-data ! / CSV-ChatBot, csv ๋ฐ์ดํ„ฐ๋กœ ๋Œ€ํ™”ํ•˜์„ธ์š”! ๐Ÿ’ฌ</h1>
12
+ """,
13
+ unsafe_allow_html=True,
14
+ )
15
+
16
+ def show_api_key_missing(self):
17
+ """
18
+ Displays a message if the user has not entered an API key
19
+ """
20
+ st.markdown(
21
+ """
22
+ <div style='text-align: center;'>
23
+ <h4>Enter your <a href="https://platform.openai.com/account/api-keys" target="_blank">OpenAI API key</a> to start chatting / ์ฑ„ํŒ…์„ ์‹œ์ž‘ํ•˜๋ ค๋ฉด <a href="https://platform.openai.com/account/api-keys" target="_blank">OpenAI API ํ‚ค</a>๋ฅผ ์ž…๋ ฅํ•˜์„ธ์š”. ๐Ÿ˜‰</h4>
24
+ </div>
25
+ """,
26
+ unsafe_allow_html=True,
27
+ )
28
+
29
+ def prompt_form(self):
30
+ """
31
+ Displays the prompt form
32
+ """
33
+ with st.form(key="my_form", clear_on_submit=True):
34
+ user_input = st.text_area(
35
+ "Query: / ์งˆ๋ฌธ:",
36
+ placeholder="Ask me anything about the document... / ๋ฌธ์„œ์— ๋Œ€ํ•ด ๋ฌด์—‡์ด๋“  ๋ฌผ์–ด๋ณด์„ธ์š”...",
37
+ key="input",
38
+ label_visibility="collapsed",
39
+ )
40
+ submit_button = st.form_submit_button(label="Send / ๋ณด๋‚ด์ฃผ์„ธ์š”")
41
+ is_ready = submit_button and user_input
42
+ return is_ready, user_input