Update app.py
Browse files
app.py
CHANGED
@@ -5,6 +5,7 @@ import torch
|
|
5 |
from utils import convert_segments_object_to_text, check_password, convert_segments_object_to_text_simple
|
6 |
from gigiachat_requests import get_access_token, get_completion_from_gigachat, get_number_of_tokens, process_transcribation_with_gigachat
|
7 |
from openai_requests import get_completion_from_openai, process_transcribation_with_assistant
|
|
|
8 |
|
9 |
if check_password():
|
10 |
st.title('Audio Transcription App')
|
@@ -19,12 +20,14 @@ if check_password():
|
|
19 |
|
20 |
min_speakers = st.sidebar.number_input("Минимальное количество спикеров", min_value=1, value=2)
|
21 |
max_speakers = st.sidebar.number_input("Максимальное количество спикеров", min_value=1, value=2)
|
22 |
-
llm = st.sidebar.selectbox("Производитель LLM", ["Сбер", "OpenAI"], index=0)
|
23 |
|
24 |
if llm == "Сбер":
|
25 |
options = ["GigaChat-Plus", "GigaChat", "GigaChat-Pro"]
|
26 |
elif llm == "OpenAI":
|
27 |
options = ["gpt-4o", "gpt-4o-mini", "gpt-4-turbo", "gpt-4", "gpt-3.5-turbo"]
|
|
|
|
|
28 |
else:
|
29 |
options = []
|
30 |
|
@@ -100,12 +103,18 @@ if check_password():
|
|
100 |
elif (llm == 'OpenAI'):
|
101 |
transcript = process_transcribation_with_assistant(processing_prompt, transcript)
|
102 |
print(transcript)
|
|
|
|
|
|
|
103 |
|
104 |
with st.spinner('Резюмируем...'):
|
105 |
if (llm == 'Сбер'):
|
106 |
summary_answer = get_completion_from_gigachat(base_prompt + transcript, 1024, access_token, llm_model)
|
107 |
elif (llm == 'OpenAI'):
|
108 |
-
summary_answer = get_completion_from_openai(base_prompt + transcript,llm_model, 1024)
|
|
|
|
|
|
|
109 |
|
110 |
st.write("Результат резюмирования:")
|
111 |
st.text(summary_answer)
|
|
|
5 |
from utils import convert_segments_object_to_text, check_password, convert_segments_object_to_text_simple
|
6 |
from gigiachat_requests import get_access_token, get_completion_from_gigachat, get_number_of_tokens, process_transcribation_with_gigachat
|
7 |
from openai_requests import get_completion_from_openai, process_transcribation_with_assistant
|
8 |
+
from qwen import respond
|
9 |
|
10 |
if check_password():
|
11 |
st.title('Audio Transcription App')
|
|
|
20 |
|
21 |
min_speakers = st.sidebar.number_input("Минимальное количество спикеров", min_value=1, value=2)
|
22 |
max_speakers = st.sidebar.number_input("Максимальное количество спикеров", min_value=1, value=2)
|
23 |
+
llm = st.sidebar.selectbox("Производитель LLM", ["Сбер", "OpenAI", "Qwen"], index=0)
|
24 |
|
25 |
if llm == "Сбер":
|
26 |
options = ["GigaChat-Plus", "GigaChat", "GigaChat-Pro"]
|
27 |
elif llm == "OpenAI":
|
28 |
options = ["gpt-4o", "gpt-4o-mini", "gpt-4-turbo", "gpt-4", "gpt-3.5-turbo"]
|
29 |
+
elif llm == "Qwen":
|
30 |
+
options = ["Qwen/Qwen2-7B-Instruct"]
|
31 |
else:
|
32 |
options = []
|
33 |
|
|
|
103 |
elif (llm == 'OpenAI'):
|
104 |
transcript = process_transcribation_with_assistant(processing_prompt, transcript)
|
105 |
print(transcript)
|
106 |
+
|
107 |
+
else:
|
108 |
+
st.write("На данный момент обработка транскрибации не поддерживается этой моделью.")
|
109 |
|
110 |
with st.spinner('Резюмируем...'):
|
111 |
if (llm == 'Сбер'):
|
112 |
summary_answer = get_completion_from_gigachat(base_prompt + transcript, 1024, access_token, llm_model)
|
113 |
elif (llm == 'OpenAI'):
|
114 |
+
summary_answer = get_completion_from_openai(base_prompt + transcript, llm_model, 1024)
|
115 |
+
elif (llm == 'Qwen'):
|
116 |
+
summary_answer = respond(base_prompt + transcript)
|
117 |
+
|
118 |
|
119 |
st.write("Результат резюмирования:")
|
120 |
st.text(summary_answer)
|