ganeshk commited on
Commit
cc80d6b
·
verified ·
1 Parent(s): 968444f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -8
app.py CHANGED
@@ -1,20 +1,29 @@
1
  import streamlit as st
2
- import webbrowser
3
-
4
 
5
  st.title('Chat LLMs Interfaces !')
6
 
7
  mistral_url = 'https://aipatseer-chatllm.hf.space'
8
  llama2_url = 'https://huggingface-projects-llama-2-7b-chat.hf.space'
9
  st.title('Select Interface')
10
- # st.image('mistral_logo.webp')
11
- # st.image('llama2_logo.png')
 
12
 
13
 
14
- if st.button('Open Mistral Chat Interface'):
15
- webbrowser.open(mistral_url)
 
 
 
 
 
 
 
 
16
  # st.markdown(mistral_url, unsafe_allow_html=True)
17
- elif st.button('Open Llama2 Chat Interface'):
18
- webbrowser.open(llama2_url)
19
  # st.markdown(llama2_url, unsafe_allow_html=True)
20
 
 
1
  import streamlit as st
2
+ # import webbrowser
3
+ from streamlit.components.v1 import html
4
 
5
  st.title('Chat LLMs Interfaces !')
6
 
7
  mistral_url = 'https://aipatseer-chatllm.hf.space'
8
  llama2_url = 'https://huggingface-projects-llama-2-7b-chat.hf.space'
9
  st.title('Select Interface')
10
+ st.image('mistral_logo.webp')
11
+ st.image('llama2_logo.png')
12
+
13
 
14
 
15
+ def open_page(url):
16
+ open_script= """
17
+ <script type="text/javascript">
18
+ window.open('%s', '_blank').focus();
19
+ </script>
20
+ """ % (url)
21
+ html(open_script)
22
+
23
+ if st.button('Mistral Chat', on_click=open_page, args=(mistral_url,)):
24
+ #webbrowser.open(mistral_url)
25
  # st.markdown(mistral_url, unsafe_allow_html=True)
26
+ elif st.button('Llama2 Chat', on_click=open_page, args=(llama2_url,)):
27
+ #webbrowser.open(llama2_url)
28
  # st.markdown(llama2_url, unsafe_allow_html=True)
29