Update app.py
Browse files
app.py
CHANGED
@@ -1,23 +1,30 @@
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
from transformers import pipeline
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
4 |
|
5 |
-
pipeline = pipeline(task="image-classification", model="julien-c/hotdog-not-hotdog")
|
6 |
|
7 |
-
st.title("Hot Dog? Or Not?")
|
8 |
|
9 |
-
file_name = st.file_uploader("Upload a hot dog candidate image")
|
10 |
|
11 |
-
if file_name is not None:
|
12 |
-
|
13 |
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
|
22 |
# Main web app
|
23 |
def main():
|
@@ -50,23 +57,23 @@ def main():
|
|
50 |
|
51 |
action = st.selectbox("Select Action", ["Add Watermark", "Decode Watermark"])
|
52 |
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
|
71 |
|
72 |
if __name__ == "__main__":
|
|
|
1 |
+
import time
|
2 |
+
import
|
3 |
import streamlit as st
|
4 |
from transformers import pipeline
|
5 |
+
import os
|
6 |
+
import torch
|
7 |
+
import datetime
|
8 |
+
import numpy as np
|
9 |
+
import soundfile
|
10 |
+
from wavmark.utils import file_reader
|
11 |
|
12 |
+
# pipeline = pipeline(task="image-classification", model="julien-c/hotdog-not-hotdog")
|
13 |
|
14 |
+
# st.title("Hot Dog? Or Not?")
|
15 |
|
16 |
+
# file_name = st.file_uploader("Upload a hot dog candidate image")
|
17 |
|
18 |
+
# if file_name is not None:
|
19 |
+
# col1, col2 = st.columns(2)
|
20 |
|
21 |
+
# image = Image.open(file_name)
|
22 |
+
# col1.image(image, use_column_width=True)
|
23 |
+
# predictions = pipeline(image)
|
24 |
|
25 |
+
# col2.header("Probabilities")
|
26 |
+
# for p in predictions:
|
27 |
+
# col2.subheader(f"{ p['label'] }: { round(p['score'] * 100, 1)}%")
|
28 |
|
29 |
# Main web app
|
30 |
def main():
|
|
|
57 |
|
58 |
action = st.selectbox("Select Action", ["Add Watermark", "Decode Watermark"])
|
59 |
|
60 |
+
# if action == "Add Watermark":
|
61 |
+
# watermark_text = st.text_input("The watermark (0, 1 list of length-16):", value=st.session_state.def_value)
|
62 |
+
# add_watermark_button = st.button("Add Watermark", key="add_watermark_btn")
|
63 |
+
# if add_watermark_button: # 点击按钮后执行的
|
64 |
+
# if audio_file and watermark_text:
|
65 |
+
# with st.spinner("Adding Watermark..."):
|
66 |
+
# watermarked_audio, encode_time_cost = add_watermark(tmp_input_audio_file, watermark_text)
|
67 |
+
# st.write("Watermarked Audio:")
|
68 |
+
# print("watermarked_audio:", watermarked_audio)
|
69 |
+
# st.audio(watermarked_audio, format="audio/wav")
|
70 |
+
# st.write("Time Cost: %d seconds" % encode_time_cost)
|
71 |
+
|
72 |
+
# # st.button("Add Watermark", disabled=False)
|
73 |
+
# elif action == "Decode Watermark":
|
74 |
+
# if st.button("Decode"):
|
75 |
+
# with st.spinner("Decoding..."):
|
76 |
+
# decode_watermark(tmp_input_audio_file)
|
77 |
|
78 |
|
79 |
if __name__ == "__main__":
|