Spaces:
Sleeping
Sleeping
Commit
·
9473f6e
1
Parent(s):
ba6af88
Upload folder using huggingface_hub
Browse files
app.py
CHANGED
@@ -26,87 +26,27 @@ def on_btn_click():
|
|
26 |
|
27 |
|
28 |
def main():
|
29 |
-
st.title("
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
)
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
L = \\frac{1}{2} \\rho v^2 S C_L
|
50 |
-
$$
|
51 |
-
|
52 |
-
~~~py
|
53 |
-
import streamlit as st
|
54 |
-
|
55 |
-
st.write("Python code block")
|
56 |
-
~~~
|
57 |
-
|
58 |
-
~~~js
|
59 |
-
console.log("Here is some JavaScript code")
|
60 |
-
~~~
|
61 |
-
"""
|
62 |
-
table_markdown = """A Table:
|
63 |
-
| Feature | Support |
|
64 |
-
| ----------: | :------------------- |
|
65 |
-
| CommonMark | 100% |
|
66 |
-
| GFM | 100% w/ `remark-gfm` |
|
67 |
-
"""
|
68 |
-
youtube_embed = """<iframe width="400" height="215" src="https://www.youtube.com/embed/LMQ5Gauy17k" title="YouTube video player" frameborder="0" allow="accelerometer; encrypted-media;"></iframe>"""
|
69 |
-
st.session_state.setdefault(
|
70 |
-
"past",
|
71 |
-
[
|
72 |
-
"plan text with line break",
|
73 |
-
'play the song "Dancing Vegetables"',
|
74 |
-
"show me image of cat",
|
75 |
-
"and video of it",
|
76 |
-
"show me some markdown sample",
|
77 |
-
"table in markdown",
|
78 |
-
],
|
79 |
-
)
|
80 |
-
st.session_state.setdefault(
|
81 |
-
"generated",
|
82 |
-
[
|
83 |
-
{"type": "normal", "data": "Line 1 \n Line 2 \n Line 3"},
|
84 |
-
{"type": "normal", "data": f'<audio controls src="{audio_path}"></audio>'},
|
85 |
-
{
|
86 |
-
"type": "normal",
|
87 |
-
"data": f'<img width="100%" height="200" src="{img_path}"/>',
|
88 |
-
},
|
89 |
-
{"type": "normal", "data": f"{youtube_embed}"},
|
90 |
-
{"type": "normal", "data": f"{markdown}"},
|
91 |
-
{"type": "table", "data": f"{table_markdown}"},
|
92 |
-
],
|
93 |
)
|
94 |
-
st.title("Chat placeholder")
|
95 |
-
chat_placeholder = st.empty()
|
96 |
-
with chat_placeholder.container():
|
97 |
-
for i in range(len(st.session_state["generated"])):
|
98 |
-
message(st.session_state["past"][i], is_user=True, key=f"{i}_user")
|
99 |
-
message(
|
100 |
-
st.session_state["generated"][i]["data"],
|
101 |
-
key=f"{i}",
|
102 |
-
allow_html=True,
|
103 |
-
is_table=True
|
104 |
-
if st.session_state["generated"][i]["type"] == "table"
|
105 |
-
else False,
|
106 |
-
)
|
107 |
-
st.button("Clear message", on_click=on_btn_click)
|
108 |
-
with st.container():
|
109 |
-
st.text_input("User Input:", on_change=on_input_change, key="user_input")
|
110 |
|
111 |
|
112 |
if __name__ == "__main__":
|
|
|
26 |
|
27 |
|
28 |
def main():
|
29 |
+
st.title(" Image Prediction (Computer Vision)")
|
30 |
+
option = st.selectbox(" ImageNet / CoCo", [" ImageNet ", " CoCo"])
|
31 |
+
value = st.slider(" Threshold", min_value=0, max_value=100, value=50, key=62)
|
32 |
+
(
|
33 |
+
col1,
|
34 |
+
col2,
|
35 |
+
) = st.columns(2)
|
36 |
+
with col1:
|
37 |
+
if st.checkbox(" Remove Noise"):
|
38 |
+
st.write("Checkbox checked!")
|
39 |
+
with col2:
|
40 |
+
if st.checkbox(" Increase Resolution"):
|
41 |
+
st.write("Checkbox checked!")
|
42 |
+
uploaded_file = st.file_uploader("Choose a file", type=["jpg", "png", "mp3"])
|
43 |
+
if st.button(" Predict"):
|
44 |
+
st.write("Button clicked!")
|
45 |
+
st.subheader(" Original vs Predicted")
|
46 |
+
image_comparison(
|
47 |
+
img1="https://www.imgonline.com.ua/examples/red-yellow-flower.jpg",
|
48 |
+
img2="https://lettatai.sirv.com/imgonline-com-ua-Negative-lYz1br1SWE.jpg",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
|
51 |
|
52 |
if __name__ == "__main__":
|