Your Name commited on
Commit
4a6f9a4
·
1 Parent(s): 03a46e8
Files changed (1) hide show
  1. app.py +11 -43
app.py CHANGED
@@ -1,45 +1,13 @@
1
- """Python file to serve as the frontend"""
2
- import streamlit as st
3
- from streamlit_chat import message
4
-
5
- from langchain.chains import ConversationChain
6
- from langchain.llms import OpenAI
7
- import os
8
-
9
- def load_chain():
10
- """Logic for loading the chain you want to use should go here."""
11
- llm = OpenAI(temperature=0)
12
- chain = ConversationChain(llm=llm)
13
- return chain
14
-
15
- chain = load_chain()
16
-
17
- # From here down is all the StreamLit UI.
18
- st.set_page_config(page_title="LangChain Demo", page_icon=":robot:")
19
- st.header("LangChain Demo")
20
-
21
- if "generated" not in st.session_state:
22
- st.session_state["generated"] = []
23
-
24
- if "past" not in st.session_state:
25
- st.session_state["past"] = []
26
 
 
 
 
 
 
 
27
 
28
- def get_text():
29
- input_text = st.text_input("You: ", "Hello, Nice to meet you", key="input")
30
- return input_text
31
-
32
-
33
- user_input = get_text()
34
-
35
- if user_input:
36
- output = chain.run(input=user_input)
37
-
38
- st.session_state.past.append(user_input)
39
- st.session_state.generated.append(output)
40
-
41
- if st.session_state["generated"]:
42
- for i in range(len(st.session_state["generated"]) - 1, -1, -1):
43
- message(st.session_state["past"][i], is_user=True, key=str(i) + "_user")
44
- message(st.session_state["generated"][i], key=str(i))
45
-
 
1
+ """
2
+ # My first app
3
+ Here's our first attempt at using data to create a table:
4
+ """
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
 
6
+ import streamlit as st
7
+ import pandas as pd
8
+ df = pd.DataFrame({
9
+ 'first column': [1, 2, 3, 4],
10
+ 'second column': [10, 20, 30, 40]
11
+ })
12
 
13
+ df