DrishtiSharma
commited on
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from few_shot import FewShotPosts
|
3 |
+
from post_generator import generate_post
|
4 |
+
|
5 |
+
|
6 |
+
# Options for length and language
|
7 |
+
length_options = ["Short", "Medium", "Long"]
|
8 |
+
language_options = ["English", "Hinglish"]
|
9 |
+
|
10 |
+
|
11 |
+
# Main app layout
|
12 |
+
def main():
|
13 |
+
st.subheader("LinkedIn Post Generator: Codebasics")
|
14 |
+
|
15 |
+
# Create three columns for the dropdowns
|
16 |
+
col1, col2, col3 = st.columns(3)
|
17 |
+
|
18 |
+
fs = FewShotPosts()
|
19 |
+
tags = fs.get_tags()
|
20 |
+
with col1:
|
21 |
+
# Dropdown for Topic (Tags)
|
22 |
+
selected_tag = st.selectbox("Topic", options=tags)
|
23 |
+
|
24 |
+
with col2:
|
25 |
+
# Dropdown for Length
|
26 |
+
selected_length = st.selectbox("Length", options=length_options)
|
27 |
+
|
28 |
+
with col3:
|
29 |
+
# Dropdown for Language
|
30 |
+
selected_language = st.selectbox("Language", options=language_options)
|
31 |
+
|
32 |
+
|
33 |
+
|
34 |
+
# Generate Button
|
35 |
+
if st.button("Generate"):
|
36 |
+
post = generate_post(selected_length, selected_language, selected_tag)
|
37 |
+
st.write(post)
|
38 |
+
|
39 |
+
|
40 |
+
# Run the app
|
41 |
+
if __name__ == "__main__":
|
42 |
+
main()
|