Divyansh Kushwaha
commited on
Commit
·
6c015bd
1
Parent(s):
32c0f9c
- Dockerfile +19 -0
- app.py +18 -0
- requirements.txt +5 -0
Dockerfile
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.9
|
| 2 |
+
|
| 3 |
+
# Create a non-root user
|
| 4 |
+
RUN useradd -m -u 1000 user
|
| 5 |
+
USER user
|
| 6 |
+
ENV PATH="/home/user/.local/bin:$PATH"
|
| 7 |
+
|
| 8 |
+
# Set working directory
|
| 9 |
+
WORKDIR /app
|
| 10 |
+
|
| 11 |
+
# Copy and install dependencies
|
| 12 |
+
COPY --chown=user ./requirements.txt requirements.txt
|
| 13 |
+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 14 |
+
|
| 15 |
+
# Copy app files
|
| 16 |
+
COPY --chown=user . /app
|
| 17 |
+
|
| 18 |
+
# Run Streamlit app
|
| 19 |
+
CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]
|
app.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from langchain_groq import ChatGroq
|
| 3 |
+
from dotenv import load_dotenv
|
| 4 |
+
import os
|
| 5 |
+
load_dotenv()
|
| 6 |
+
GROQ_API_KEY= os.getenv('GROQ_API_KEY')
|
| 7 |
+
|
| 8 |
+
llm = ChatGroq(api_key=GROQ_API_KEY, model="llama-3.1-8b-instant")
|
| 9 |
+
|
| 10 |
+
# Streamlit UI
|
| 11 |
+
st.title("Groq AI Chatbot")
|
| 12 |
+
st.write("Enter your message below:")
|
| 13 |
+
|
| 14 |
+
user_input = st.text_input("You:", "")
|
| 15 |
+
|
| 16 |
+
if st.button("Submit") and user_input:
|
| 17 |
+
response = llm.invoke(user_input)
|
| 18 |
+
st.text_area("Groq AI:", response, height=200)
|
requirements.txt
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
streamlit
|
| 2 |
+
requests
|
| 3 |
+
langchain_groq
|
| 4 |
+
langchain
|
| 5 |
+
python-dotenv
|