Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1644,16 +1644,16 @@ def process_image(image_input):
|
|
1644 |
)
|
1645 |
image_response = response.choices[0].message.content
|
1646 |
st.markdown(image_response)
|
1647 |
-
|
1648 |
-
|
1649 |
-
# Save the image with a new filename based on the response
|
1650 |
-
#save_image(image_input, image_response)
|
1651 |
|
1652 |
filename_txt = generate_filename(image_response, "md") # Save markdown on image AI output from gpt4o
|
1653 |
create_file(filename_txt, image_response, '', True) #create_file() # create_file() 3 required positional arguments: 'filename', 'prompt', and 'response'
|
1654 |
|
1655 |
filename_txt = generate_filename(image_response, "png")
|
1656 |
save_image(image_input, filename_txt) # Save copy of image with new filename
|
|
|
|
|
|
|
|
|
1657 |
|
1658 |
def process_audio(audio_input):
|
1659 |
if audio_input:
|
@@ -1767,7 +1767,8 @@ def main():
|
|
1767 |
process_text()
|
1768 |
elif option == "Image":
|
1769 |
image_input = st.file_uploader("Upload an image", type=["jpg", "jpeg", "png"])
|
1770 |
-
process_image(image_input)
|
|
|
1771 |
elif option == "Audio":
|
1772 |
audio_input = st.file_uploader("Upload an audio file", type=["mp3", "wav"])
|
1773 |
process_audio(audio_input)
|
|
|
1644 |
)
|
1645 |
image_response = response.choices[0].message.content
|
1646 |
st.markdown(image_response)
|
|
|
|
|
|
|
|
|
1647 |
|
1648 |
filename_txt = generate_filename(image_response, "md") # Save markdown on image AI output from gpt4o
|
1649 |
create_file(filename_txt, image_response, '', True) #create_file() # create_file() 3 required positional arguments: 'filename', 'prompt', and 'response'
|
1650 |
|
1651 |
filename_txt = generate_filename(image_response, "png")
|
1652 |
save_image(image_input, filename_txt) # Save copy of image with new filename
|
1653 |
+
st.rerun() # rerun to show new image and new markdown files
|
1654 |
+
|
1655 |
+
reurn image_response
|
1656 |
+
|
1657 |
|
1658 |
def process_audio(audio_input):
|
1659 |
if audio_input:
|
|
|
1767 |
process_text()
|
1768 |
elif option == "Image":
|
1769 |
image_input = st.file_uploader("Upload an image", type=["jpg", "jpeg", "png"])
|
1770 |
+
image_response = process_image(image_input)
|
1771 |
+
st.markdown(image_response)
|
1772 |
elif option == "Audio":
|
1773 |
audio_input = st.file_uploader("Upload an audio file", type=["mp3", "wav"])
|
1774 |
process_audio(audio_input)
|