AlanFeder commited on
Commit
f37551c
·
verified ·
1 Parent(s): 0545200

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -1
app.py CHANGED
@@ -3,7 +3,19 @@ import sys
3
 
4
  from shiny.express import input, ui
5
 
6
- from all_rag_fns import do_rag
 
 
 
 
 
 
 
 
 
 
 
 
7
 
8
  oai_api_key = os.getenv("OPENAI_API_KEY")
9
  ui.page_opts(
@@ -27,6 +39,22 @@ with ui.layout_sidebar():
27
  chat = ui.Chat(id="chat")
28
  chat.ui()
29
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
 
31
  # Define a callback to run when the user submits a message
32
  @chat.on_user_submit
 
3
 
4
  from shiny.express import input, ui
5
 
6
+ # Get the directory of the current script
7
+ current_dir = os.path.dirname(__file__)
8
+
9
+ # Move up to the parent directory and then to the cousin folder
10
+ cousin_folder = os.path.join(current_dir, "..", "b1_rag_fns")
11
+
12
+ # Add cousin folder to sys.path so it can be imported
13
+ sys.path.append(os.path.abspath(cousin_folder))
14
+
15
+ from b1_all_rag_fns import do_rag
16
+ from dotenv import load_dotenv
17
+
18
+ is_env = load_dotenv()
19
 
20
  oai_api_key = os.getenv("OPENAI_API_KEY")
21
  ui.page_opts(
 
39
  chat = ui.Chat(id="chat")
40
  chat.ui()
41
 
42
+ ui.markdown(
43
+ """
44
+ This app was created for Alan Feder's [talk at the 2024 R/Gov Conference](https://rstats.ai/nyr.html).
45
+
46
+ The Github repository that houses all the code is [here](https://github.com/AlanFeder/rgov-2024) -- feel free to fork it and use it on your own!
47
+ """
48
+ )
49
+ ui.hr() # Divider
50
+ ui.h3("Contact me!")
51
+ ui.img(src="https://raw.githubusercontent.com/AlanFeder/rgov-2024/refs/heads/main/AJF_Headshot.jpg", width="60px")
52
+ ui.markdown(
53
+ """
54
+ [Email](mailto:[email protected]) | [Website](https://www.alanfeder.com/) | [LinkedIn](https://www.linkedin.com/in/alanfeder/) | [GitHub](https://github.com/AlanFeder)
55
+ """
56
+ )
57
+
58
 
59
  # Define a callback to run when the user submits a message
60
  @chat.on_user_submit