mgokg commited on
Commit
4a37332
·
verified ·
1 Parent(s): c05c5ab

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -4
app.py CHANGED
@@ -44,7 +44,7 @@ def update(message):
44
  response = requests.post(url, headers=headers, data=json.dumps(data))
45
  return response.json()['choices'][0]['message']['content']
46
 
47
-
48
 
49
  # Function to transcribe audio data to text
50
  def transcribe_audio(audio):
@@ -53,8 +53,17 @@ def transcribe_audio(audio):
53
  audio_data = recognizer.record(source)
54
  try:
55
  text = recognizer.recognize_google(audio_data, language="de-DE")
56
- text = update(text)
57
- return text
 
 
 
 
 
 
 
 
 
58
  except sr.UnknownValueError:
59
  return "Speech recognition could not understand the audio."
60
  except sr.RequestError as e:
@@ -63,7 +72,7 @@ def transcribe_audio(audio):
63
 
64
 
65
 
66
- client = Client("Qwen/Qwen2.5-72B-Instruct")
67
  def ask_llm(llm_prompt_input):
68
  # Erstelle Embedding für den Prompt
69
  query_embedding = embedding_function([llm_prompt_input])[0]
 
44
  response = requests.post(url, headers=headers, data=json.dumps(data))
45
  return response.json()['choices'][0]['message']['content']
46
 
47
+ client = Client("Qwen/Qwen2.5-72B-Instruct")
48
 
49
  # Function to transcribe audio data to text
50
  def transcribe_audio(audio):
 
53
  audio_data = recognizer.record(source)
54
  try:
55
  text = recognizer.recognize_google(audio_data, language="de-DE")
56
+ result = client.predict(
57
+ query=text,
58
+ history=[],
59
+ system="You are Qwen, created by Alibaba Cloud. You are a helpful assistant.",
60
+ api_name="/model_chat"
61
+ )
62
+ result = result[1]
63
+ result=gr.Markdown(result)
64
+ return result
65
+ #text = update(text)
66
+ #return text
67
  except sr.UnknownValueError:
68
  return "Speech recognition could not understand the audio."
69
  except sr.RequestError as e:
 
72
 
73
 
74
 
75
+
76
  def ask_llm(llm_prompt_input):
77
  # Erstelle Embedding für den Prompt
78
  query_embedding = embedding_function([llm_prompt_input])[0]