|
import streamlit as st |
|
import gradio as gr |
|
from streamlit_gradio import st_gradio |
|
|
|
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) |
|
|
|
|
|
gr_interface = gr.Interface(fn=chat_with_model, inputs="text", outputs="text") |
|
|
|
|
|
st_gradio(gr_interface) |
|
|
|
if __name__ == "__main__": |
|
main() |
|
|