Ley_Fill7 commited on
Commit
9c9f4d0
·
1 Parent(s): 250b749

Added user input and response display for chat app

Browse files
Files changed (1) hide show
  1. app.py +12 -2
app.py CHANGED
@@ -1,5 +1,15 @@
1
  import streamlit as st
 
2
 
3
- x = st.slider('Select a value')
4
- st.write(x, 'squared is', x * x)
 
 
 
 
 
 
 
 
 
5
 
 
1
  import streamlit as st
2
+ import cohere
3
 
4
+ st.title("My First Cohere-based Chat App on HF Space")
5
+
6
+ co = cohere.Client("3xjTiuBZlBOnNWZPTAsAVZzUeA9l6Z2i0MZtQlZW")
7
+
8
+ user_question = st.text_input("Ask me anything!")
9
+
10
+ if user_question: # Check if user entered a question
11
+ response = co.generate(
12
+ prompt=user_question,
13
+ )
14
+ st.write(response.text) # Display Cohere's response
15