Sabbah13 commited on
Commit
e8a4c9c
1 Parent(s): 124547b

added getting number of tokens for proccessing and removed whisper settings

Browse files
Files changed (1) hide show
  1. app.py +8 -7
app.py CHANGED
@@ -3,15 +3,15 @@ import streamlit as st
3
  import whisperx
4
  import torch
5
  from utils import convert_segments_object_to_text, check_password
6
- from gigiachat_requests import get_access_token, get_completion_from_gigachat
7
 
8
  if check_password():
9
  st.title('Audio Transcription App')
10
  st.sidebar.title("Settings")
11
- # Sidebar inputs
12
- device = st.sidebar.selectbox("Device", ["cpu", "cuda"], index=1)
13
- batch_size = st.sidebar.number_input("Batch Size", min_value=1, value=16)
14
- compute_type = st.sidebar.selectbox("Compute Type", ["float16", "int8"], index=0)
15
 
16
  initial_giga_base_prompt = os.getenv('GIGA_BASE_PROMPT')
17
  initial_giga_processing_prompt = os.getenv('GIGA_PROCCESS_PROMPT')
@@ -58,8 +58,9 @@ if check_password():
58
 
59
  if (enable_summarization):
60
  with st.spinner('Обрабатываем транскрибацию...'):
61
- transcript = get_completion_from_gigachat(giga_processing_prompt + transcript, 32768, access_token)
62
-
 
63
  st.write("Результат обработки:")
64
  st.text(transcript)
65
 
 
3
  import whisperx
4
  import torch
5
  from utils import convert_segments_object_to_text, check_password
6
+ from gigiachat_requests import get_access_token, get_completion_from_gigachat, get_number_of_tokens
7
 
8
  if check_password():
9
  st.title('Audio Transcription App')
10
  st.sidebar.title("Settings")
11
+
12
+ device = os.getenv('DEVICE')
13
+ batch_size = int(os.getenv('BATCH_SIZE'))
14
+ compute_type = os.getenv('COMPUTE_TYPE')
15
 
16
  initial_giga_base_prompt = os.getenv('GIGA_BASE_PROMPT')
17
  initial_giga_processing_prompt = os.getenv('GIGA_PROCCESS_PROMPT')
 
58
 
59
  if (enable_summarization):
60
  with st.spinner('Обрабатываем транскрибацию...'):
61
+ number_of_tokens = get_number_of_tokens(transcript, access_token)
62
+ transcript = get_completion_from_gigachat(giga_processing_prompt + transcript, number_of_tokens, access_token)
63
+
64
  st.write("Результат обработки:")
65
  st.text(transcript)
66