CogwiseAI commited on
Commit
42dfa59
1 Parent(s): 1eb55be

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -6
app.py CHANGED
@@ -1,6 +1,5 @@
1
  import streamlit as st
2
  import gradio as gr
3
- from streamlit_gradio import st_gradio
4
 
5
  def chat_with_model(input_text):
6
  # Call the chat model and return the response
@@ -25,11 +24,15 @@ def main():
25
  st.markdown("---")
26
  st.write(response)
27
 
28
- # Create the Gradio interface
29
- gr_interface = gr.Interface(fn=chat_with_model, inputs="text", outputs="text")
30
-
31
- # Render the Gradio interface using the st_gradio function
32
- st_gradio(gr_interface)
 
 
 
 
33
 
34
  if __name__ == "__main__":
35
  main()
 
1
  import streamlit as st
2
  import gradio as gr
 
3
 
4
  def chat_with_model(input_text):
5
  # Call the chat model and return the response
 
24
  st.markdown("---")
25
  st.write(response)
26
 
27
+ # Render the Gradio interface using Streamlit's st.form and st.button
28
+ with st.form(key="my_form"):
29
+ text_input = st.text_input("Enter your question")
30
+ submit_button = st.form_submit_button(label="Ask")
31
+ if submit_button:
32
+ with st.spinner("Thinking..."):
33
+ response = chat_with_model(text_input)
34
+ st.markdown("---")
35
+ st.write(response)
36
 
37
  if __name__ == "__main__":
38
  main()