g3eIL commited on
Commit
8717e23
·
verified ·
1 Parent(s): 33dd624

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -0
app.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from transformers import pipeline
3
+ pipe = pipeline("text-generation", model="infiagent/daagent_7b")
4
+
5
+
6
+ st.title("InfiAgent Code Interpreter Demo 🚀")
7
+ input_text = st.text_area("Write your prompt")
8
+ uploaded_files = st.file_uploader("Upload your files", accept_multiple_files=True)
9
+ button_pressed = st.button("Run code interpreter", use_container_width=True)
10
+
11
+ if 'chat_history' not in st.session_state:
12
+ st.session_state.chat_history = []
13
+
14
+ if button_pressed and input_text != "":
15
+ # Add user message to chat history
16
+ st.session_state.chat_history.append({"role": "user", "message": input_text})
17
+ response = pipe(uploaded_files)
18
+ st.session_state.chat_history.append({"role": "assistant", "message": response})
19
+
20
+ for chat in st.session_state.chat_history:
21
+ with st.chat_message(chat["role"]):
22
+ st.write(chat["message"])