|
import streamlit as st |
|
import gradio as gr |
|
|
|
def chat_with_model(input_text): |
|
|
|
response = chat_model.predict(input_text) |
|
return response |
|
|
|
|
|
chat_model = gr.Interface.load("models/CogwiseAI/CogwiseAI-chatwithMS") |
|
|
|
|
|
def main(): |
|
st.title("Cogwise Intelligent Assistant") |
|
st.markdown("---") |
|
|
|
|
|
input_text = st.text_input("You are talking to an AI, ask any question.") |
|
|
|
|
|
if st.button("Ask"): |
|
with st.spinner("Thinking..."): |
|
response = chat_with_model(input_text) |
|
st.markdown("---") |
|
st.write(response) |
|
|
|
|
|
with st.form(key="my_form"): |
|
text_input = st.text_input("Enter your question") |
|
submit_button = st.form_submit_button(label="Ask") |
|
if submit_button: |
|
with st.spinner("Thinking..."): |
|
response = chat_with_model(text_input) |
|
st.markdown("---") |
|
st.write(response) |
|
|
|
if __name__ == "__main__": |
|
main() |
|
|