Sabbah13 commited on
Commit
024f740
·
verified ·
1 Parent(s): 6379da1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -27
app.py CHANGED
@@ -1,11 +1,10 @@
1
- import requests
2
- import base64
3
  import os
4
- import json
5
  import streamlit as st
6
  import whisperx
7
  import torch
8
- from utils import convert_segments_object_to_text, get_completion_from_gigachat
 
 
9
 
10
  st.title('Audio Transcription App')
11
  st.sidebar.title("Settings")
@@ -55,29 +54,7 @@ if uploaded_file is not None:
55
  transcript = convert_segments_object_to_text(result_diar)
56
  st.text(transcript)
57
 
58
- username = st.secrets["GIGA_USERNAME"]
59
- password = st.secrets["GIGA_SECRET"]
60
-
61
- # Получаем строку с базовой авторизацией в формате Base64
62
- auth_str = f'{username}:{password}'
63
- auth_bytes = auth_str.encode('utf-8')
64
- auth_base64 = base64.b64encode(auth_bytes).decode('utf-8')
65
- url = os.getenv('GIGA_AUTH_URL')
66
-
67
- headers = {
68
- 'Authorization': f'Basic {auth_base64}', # вставляем базовую авторизацию
69
- 'RqUID': os.getenv('GIGA_rquid'),
70
- 'Content-Type': 'application/x-www-form-urlencoded',
71
- 'Accept': 'application/json'
72
- }
73
-
74
- data = {
75
- 'scope': os.getenv('GIGA_SCOPE')
76
- }
77
-
78
- response = requests.post(url, headers=headers, data=data, verify=False)
79
- access_token = response.json()['access_token']
80
- print('Got access token')
81
 
82
  if (enable_summarization):
83
  with st.spinner('Обрабатываем транскрибацию...'):
 
 
 
1
  import os
 
2
  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
 
9
  st.title('Audio Transcription App')
10
  st.sidebar.title("Settings")
 
54
  transcript = convert_segments_object_to_text(result_diar)
55
  st.text(transcript)
56
 
57
+ access_token = get_access_token()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
 
59
  if (enable_summarization):
60
  with st.spinner('Обрабатываем транскрибацию...'):