Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,3 @@
|
|
1 |
-
# streamlit_app.py
|
2 |
import streamlit as st
|
3 |
from fastai.vision.all import *
|
4 |
import shutil
|
@@ -40,14 +39,23 @@ def main():
|
|
40 |
|
41 |
if choice == "Train Model":
|
42 |
st.subheader("Training the Model")
|
43 |
-
food_path =
|
44 |
-
|
45 |
-
|
|
|
|
|
46 |
|
47 |
-
|
48 |
-
|
49 |
|
50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
|
52 |
elif choice == "Upload Image":
|
53 |
st.subheader("Upload Your Own Images")
|
|
|
|
|
1 |
import streamlit as st
|
2 |
from fastai.vision.all import *
|
3 |
import shutil
|
|
|
39 |
|
40 |
if choice == "Train Model":
|
41 |
st.subheader("Training the Model")
|
42 |
+
food_path = Path("~/.fastai/data/food-101/food-101").expanduser()
|
43 |
+
if not food_path.exists():
|
44 |
+
food_path = untar_data(URLs.FOOD)
|
45 |
+
label_a = st.text_input("Enter label A:", "samosa")
|
46 |
+
label_b = st.text_input("Enter label B:", "hot_and_sour_soup")
|
47 |
|
48 |
+
prepare_data(food_path, label_a, label_b)
|
49 |
+
learn = train_model(food_path, get_label)
|
50 |
|
51 |
+
st.session_state.model = learn # Save the model to session state
|
52 |
+
st.success("Model trained successfully!")
|
53 |
+
|
54 |
+
# ... (rest of the code remains unchanged)
|
55 |
+
|
56 |
+
# Run the Streamlit app
|
57 |
+
if __name__ == "__main__":
|
58 |
+
main()
|
59 |
|
60 |
elif choice == "Upload Image":
|
61 |
st.subheader("Upload Your Own Images")
|