Upload app.py
Browse files
app.py
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import openai
|
3 |
+
import tiktoken
|
4 |
+
from openai.embeddings_utils import get_embedding, cosine_similarity
|
5 |
+
import torch
|
6 |
+
from sentence_transformers import SentenceTransformer, util
|
7 |
+
|
8 |
+
# Set Streamlit page configuration
|
9 |
+
st.set_page_config(page_title="home", layout="wide")
|
10 |
+
|
11 |
+
st.title("Streamlit App around GPT")
|
12 |
+
|
13 |
+
model_options = st.sidebar.selectbox("Choose the free embeddings model to use ?", ('all-MiniLM-L6-v2', 'multi-qa-mpnet-base-dot-v1'))
|
14 |
+
|
15 |
+
if ok_openai := st.checkbox('You want to use the OpenAI Embeddings'):
|
16 |
+
if openai_api_key := st.text_input(
|
17 |
+
":blue[Put Your OPENAI API-KEY :]",
|
18 |
+
placeholder="Paste your OpenAI API key here ",
|
19 |
+
type="password",
|
20 |
+
):
|
21 |
+
st.success("great")
|
22 |
+
|
23 |
+
col1, col2 = st.columns(2)
|
24 |
+
if query := st.text_input(
|
25 |
+
":orange[Enter your question :]"):
|
26 |
+
with col1:
|
27 |
+
st.write("OpenAI place")
|
28 |
+
with col2:
|
29 |
+
st.write("Open LLM place")
|