Spaces:
Sleeping
Sleeping
Nathan Butters commited on
Commit ·
25a3c6c
1
Parent(s): 4bee960
attempt to fix image url
Browse files- .gitignore +3 -0
- app.py +4 -3
- tempDir/picture.png +0 -0
.gitignore
CHANGED
|
@@ -161,3 +161,6 @@ cython_debug/
|
|
| 161 |
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
| 162 |
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
| 163 |
#.idea/
|
|
|
|
|
|
|
|
|
|
|
|
| 161 |
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
| 162 |
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
| 163 |
#.idea/
|
| 164 |
+
|
| 165 |
+
# Other
|
| 166 |
+
tempDir/picture.png
|
app.py
CHANGED
|
@@ -8,6 +8,7 @@ import logging
|
|
| 8 |
from helpers.constant import *
|
| 9 |
from helpers.chat import basicChat, guidedMM, mmChat
|
| 10 |
import os
|
|
|
|
| 11 |
|
| 12 |
logger = logging.getLogger(__name__)
|
| 13 |
logging.basicConfig(filename='app.log', level=logging.INFO)
|
|
@@ -18,7 +19,6 @@ def update_model(name):
|
|
| 18 |
else:
|
| 19 |
st.session_state.model = QWEN
|
| 20 |
|
| 21 |
-
|
| 22 |
if "model" not in st.session_state:
|
| 23 |
st.session_state.model = LLAMA
|
| 24 |
if "systemPrompt" not in st.session_state:
|
|
@@ -34,7 +34,7 @@ with st.sidebar:
|
|
| 34 |
systemPrompt = st.radio("Designate a control persona:",options=["Model","Tutor"])
|
| 35 |
st.session_state.systemPrompt = systemPrompt
|
| 36 |
st.subheader(f"This experience is currently running on {st.session_state.model}")
|
| 37 |
-
|
| 38 |
# Initialize chat history
|
| 39 |
if "messages" not in st.session_state:
|
| 40 |
st.session_state.messages = []
|
|
@@ -51,7 +51,8 @@ picture = st.camera_input("Take a picture of your math work", disabled=not enabl
|
|
| 51 |
if picture is not None:
|
| 52 |
with open(os.path.join("tempDir","picture.png"),"wb") as f:
|
| 53 |
f.write(picture.getbuffer())
|
| 54 |
-
|
|
|
|
| 55 |
#guidedMM(st.session_state.systemPrompt, "http://192.168.50.36:8501/tempDir/picture")
|
| 56 |
else:
|
| 57 |
basicChat()
|
|
|
|
| 8 |
from helpers.constant import *
|
| 9 |
from helpers.chat import basicChat, guidedMM, mmChat
|
| 10 |
import os
|
| 11 |
+
import requests
|
| 12 |
|
| 13 |
logger = logging.getLogger(__name__)
|
| 14 |
logging.basicConfig(filename='app.log', level=logging.INFO)
|
|
|
|
| 19 |
else:
|
| 20 |
st.session_state.model = QWEN
|
| 21 |
|
|
|
|
| 22 |
if "model" not in st.session_state:
|
| 23 |
st.session_state.model = LLAMA
|
| 24 |
if "systemPrompt" not in st.session_state:
|
|
|
|
| 34 |
systemPrompt = st.radio("Designate a control persona:",options=["Model","Tutor"])
|
| 35 |
st.session_state.systemPrompt = systemPrompt
|
| 36 |
st.subheader(f"This experience is currently running on {st.session_state.model}")
|
| 37 |
+
my_ip = get_ip()
|
| 38 |
# Initialize chat history
|
| 39 |
if "messages" not in st.session_state:
|
| 40 |
st.session_state.messages = []
|
|
|
|
| 51 |
if picture is not None:
|
| 52 |
with open(os.path.join("tempDir","picture.png"),"wb") as f:
|
| 53 |
f.write(picture.getbuffer())
|
| 54 |
+
img_url = f"https://huggingface.co/spaces/butterswords/MM_Math_Helper/resolve/main/tempDir/picture.png"
|
| 55 |
+
mmChat(img_url)
|
| 56 |
#guidedMM(st.session_state.systemPrompt, "http://192.168.50.36:8501/tempDir/picture")
|
| 57 |
else:
|
| 58 |
basicChat()
|
tempDir/picture.png
CHANGED
|
|