Spaces:
Sleeping
Sleeping
Deploy recipe generator to HF Spaces
Browse files- .gitignore +3 -1
- Dockerfile +3 -1
- app.py +3 -1
- requirements.txt +2 -1
.gitignore
CHANGED
|
@@ -1,3 +1,5 @@
|
|
| 1 |
__pycache__/
|
| 2 |
*.pyc
|
| 3 |
-
.streamlit/
|
|
|
|
|
|
|
|
|
| 1 |
__pycache__/
|
| 2 |
*.pyc
|
| 3 |
+
.streamlit/
|
| 4 |
+
venv/
|
| 5 |
+
*.env
|
Dockerfile
CHANGED
|
@@ -7,4 +7,6 @@ RUN pip install -r requirements.txt
|
|
| 7 |
|
| 8 |
COPY . .
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
COPY . .
|
| 9 |
|
| 10 |
+
EXPOSE 7860
|
| 11 |
+
|
| 12 |
+
CMD streamlit run app.py --server.port=7860 --server.address=0.0.0.0
|
app.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
from transformers import pipeline
|
| 3 |
|
|
@@ -9,7 +10,8 @@ st.write("Enter ingredients and get a recipe suggestion!")
|
|
| 9 |
# Load the model (runs once, cached)
|
| 10 |
@st.cache_resource
|
| 11 |
def load_model():
|
| 12 |
-
|
|
|
|
| 13 |
|
| 14 |
model = load_model()
|
| 15 |
|
|
|
|
| 1 |
+
import os
|
| 2 |
import streamlit as st
|
| 3 |
from transformers import pipeline
|
| 4 |
|
|
|
|
| 10 |
# Load the model (runs once, cached)
|
| 11 |
@st.cache_resource
|
| 12 |
def load_model():
|
| 13 |
+
token = os.environ.get("HF_TOKEN")
|
| 14 |
+
return pipeline('text-generation', model='mistralai/Mistral-7B-Instruct-v0.1', token=token)
|
| 15 |
|
| 16 |
model = load_model()
|
| 17 |
|
requirements.txt
CHANGED
|
@@ -1,3 +1,4 @@
|
|
| 1 |
streamlit>=1.28.0
|
| 2 |
transformers>=4.35.0
|
| 3 |
-
torch>=2.6.0
|
|
|
|
|
|
| 1 |
streamlit>=1.28.0
|
| 2 |
transformers>=4.35.0
|
| 3 |
+
torch>=2.6.0
|
| 4 |
+
accelerate>=0.26.0
|