cptsubtext commited on
Commit
bd64ae8
Β·
1 Parent(s): 737ca30

UI Elements revamped

Browse files
Files changed (1) hide show
  1. app.py +9 -71
app.py CHANGED
@@ -1,79 +1,17 @@
1
  import streamlit as st
 
2
  import requests
3
  import os
4
 
5
  # Variables
6
- api_token = st.secrets["API_TOKEN"]
7
 
8
- # Page Title
9
- st.set_page_config(
10
- page_title="Speech-to-Text Transcription App", page_icon="πŸ‘„", layout="wide"
11
- )
12
 
13
- def _max_width_():
14
- max_width_str = f"max-width: 1200px;"
15
- st.markdown(
16
- f"""
17
- <style>
18
- .reportview-container .main .block-container{{
19
- {max_width_str}
20
- }}
21
- </style>
22
- """,
23
- unsafe_allow_html=True,
24
- )
25
 
26
- _max_width_()
27
-
28
- # logo and header -------------------------------------------------
29
-
30
- c30, c31, c32 = st.columns([2.5, 1, 3])
31
-
32
- with c30:
33
- st.image("logo.png", width=350)
34
- st.header("")
35
-
36
- with c32:
37
-
38
- st.title("")
39
- st.title("")
40
- st.caption("")
41
- st.caption("")
42
- st.caption("")
43
- st.caption("")
44
- st.caption("")
45
- st.caption("")
46
-
47
- st.write(
48
- "&nbsp &nbsp Made in [![this is an image link](https://i.imgur.com/iIOA6kU.png)](https://www.streamlit.io/)&nbsp, with :heart: by [@DataChaz](https://www.charlywargnier.com/) | [![this is an image link](https://i.imgur.com/thJhzOO.png)](https://www.buymeacoffee.com/cwar05)"
49
- )
50
-
51
- st.text("")
52
- st.markdown(
53
- f"""
54
- The speech to text recognition is done via the [Facebook's Wav2Vec2 model.](https://huggingface.co/facebook/wav2vec2-large-960h)
55
- """
56
- )
57
- st.text("")
58
-
59
- # region Main
60
-
61
- def main():
62
- pages = {
63
- "πŸ‘Ύ Free mode (2MB per API call)": demo,
64
- "πŸ€— Full mode": API_key,
65
-
66
- }
67
-
68
- if "page" not in st.session_state:
69
- st.session_state.update(
70
- {
71
- # Default page
72
- "page": "Home",
73
- }
74
- )
75
-
76
- with st.sidebar:
77
- page = st.radio("Select your mode", tuple(pages.keys()))
78
-
79
- pages[page]()
 
1
  import streamlit as st
2
+ from stable_whisper import load_model
3
  import requests
4
  import os
5
 
6
  # Variables
7
+ valid_api_token = st.secrets["API_TOKEN"]
8
 
9
+ # Free tier or API token option
10
+ use_free_tier = st.checkbox("Free Tier (Max 2 minutes)")
11
+ api_token = st.text_input("API Token (Unlimited)")
 
12
 
13
+ # Model selection
14
+ model_size = st.selectbox("Model Size", ("tiny", "base", "small", "medium"))
 
 
 
 
 
 
 
 
 
 
15
 
16
+ # Upload audio file
17
+ uploaded_file = st.file_uploader("Upload Audio File", type=["mp3", "wav"])