nit fix
Browse files
app.py
CHANGED
|
@@ -90,8 +90,6 @@ LANGUAGE_MODEL = HuggingFaceHub(
|
|
| 90 |
huggingfacehub_api_token=HUGGINGFACEHUB_API_TOKEN
|
| 91 |
)
|
| 92 |
|
| 93 |
-
|
| 94 |
-
|
| 95 |
def save_uploaded_file(uploaded_file):
|
| 96 |
file_path = PDF_STORAGE_PATH + uploaded_file.name
|
| 97 |
with open(file_path, "wb") as file:
|
|
|
|
| 90 |
huggingfacehub_api_token=HUGGINGFACEHUB_API_TOKEN
|
| 91 |
)
|
| 92 |
|
|
|
|
|
|
|
| 93 |
def save_uploaded_file(uploaded_file):
|
| 94 |
file_path = PDF_STORAGE_PATH + uploaded_file.name
|
| 95 |
with open(file_path, "wb") as file:
|
trial.py
DELETED
|
@@ -1,39 +0,0 @@
|
|
| 1 |
-
import streamlit as st
|
| 2 |
-
from langchain.llms import HuggingFaceHub
|
| 3 |
-
from langchain.chains import ConversationChain
|
| 4 |
-
from langchain.memory import ConversationBufferMemory
|
| 5 |
-
import os
|
| 6 |
-
|
| 7 |
-
HUGGINGFACEHUB_API_TOKEN = os.getenv("HUGGINGFACEHUB_API_TOKEN")
|
| 8 |
-
|
| 9 |
-
# Model to use
|
| 10 |
-
MODEL_REPO = "mistralai/Mixtral-8x7B-Instruct-v0.1"
|
| 11 |
-
|
| 12 |
-
# Setup the LLM using LangChain + Hugging Face Inference API
|
| 13 |
-
llm = HuggingFaceHub(
|
| 14 |
-
repo_id=MODEL_REPO,
|
| 15 |
-
model_kwargs={"temperature": 0.7, "max_new_tokens": 2000},
|
| 16 |
-
huggingfacehub_api_token=HUGGINGFACEHUB_API_TOKEN
|
| 17 |
-
)
|
| 18 |
-
|
| 19 |
-
# Add memory to remember the chat history
|
| 20 |
-
memory = ConversationBufferMemory()
|
| 21 |
-
|
| 22 |
-
# Setup the conversation chain
|
| 23 |
-
conversation = ConversationChain(
|
| 24 |
-
llm=llm,
|
| 25 |
-
memory=memory,
|
| 26 |
-
verbose=False
|
| 27 |
-
)
|
| 28 |
-
|
| 29 |
-
# Streamlit app
|
| 30 |
-
st.set_page_config(page_title="DeepSeek LLM (LangChain API)", page_icon="π€")
|
| 31 |
-
st.title("π€ DeepSeek Chatbot via LangChain (API)")
|
| 32 |
-
|
| 33 |
-
user_input = st.text_input("You:", "")
|
| 34 |
-
|
| 35 |
-
if user_input:
|
| 36 |
-
response = conversation.predict(input=user_input)
|
| 37 |
-
st.markdown(f"**π€ DeepSeek:** {response}")
|
| 38 |
-
print(response)
|
| 39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trial.txt
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# import streamlit as st
|
| 2 |
+
# from langchain.llms import HuggingFaceHub
|
| 3 |
+
# from langchain.chains import ConversationChain
|
| 4 |
+
# from langchain.memory import ConversationBufferMemory
|
| 5 |
+
# import os
|
| 6 |
+
|
| 7 |
+
# HUGGINGFACEHUB_API_TOKEN = os.getenv("HUGGINGFACEHUB_API_TOKEN")
|
| 8 |
+
|
| 9 |
+
# # Model to use
|
| 10 |
+
# MODEL_REPO = "mistralai/Mixtral-8x7B-Instruct-v0.1"
|
| 11 |
+
|
| 12 |
+
# # Setup the LLM using LangChain + Hugging Face Inference API
|
| 13 |
+
# llm = HuggingFaceHub(
|
| 14 |
+
# repo_id=MODEL_REPO,
|
| 15 |
+
# model_kwargs={"temperature": 0.7, "max_new_tokens": 2000},
|
| 16 |
+
# huggingfacehub_api_token=HUGGINGFACEHUB_API_TOKEN
|
| 17 |
+
# )
|
| 18 |
+
|
| 19 |
+
# # Add memory to remember the chat history
|
| 20 |
+
# memory = ConversationBufferMemory()
|
| 21 |
+
|
| 22 |
+
# # Setup the conversation chain
|
| 23 |
+
# conversation = ConversationChain(
|
| 24 |
+
# llm=llm,
|
| 25 |
+
# memory=memory,
|
| 26 |
+
# verbose=False
|
| 27 |
+
# )
|
| 28 |
+
|
| 29 |
+
# # Streamlit app
|
| 30 |
+
# st.set_page_config(page_title="DeepSeek LLM (LangChain API)", page_icon="π€")
|
| 31 |
+
# st.title("π€ DeepSeek Chatbot via LangChain (API)")
|
| 32 |
+
|
| 33 |
+
# user_input = st.text_input("You:", "")
|
| 34 |
+
|
| 35 |
+
# if user_input:
|
| 36 |
+
# response = conversation.predict(input=user_input)
|
| 37 |
+
# st.markdown(f"**π€ DeepSeek:** {response}")
|
| 38 |
+
# print(response)
|
| 39 |
+
|