ariankhalfani commited on
Commit
8d57442
1 Parent(s): 60ae91a

Update chatbot.py

Browse files
Files changed (1) hide show
  1. chatbot.py +6 -7
chatbot.py CHANGED
@@ -7,14 +7,13 @@ from pydub import AudioSegment
7
  from io import BytesIO
8
  import time
9
  import sqlite3
10
- import re
 
 
11
 
12
  # Configure logging
13
  logging.basicConfig(level=logging.DEBUG)
14
 
15
- # Load environment variables
16
- load_dotenv()
17
-
18
  # Configure Hugging Face API URL and headers for Meta-Llama-3-70B-Instruct
19
  api_url = "https://api-inference.huggingface.co/models/meta-llama/Meta-Llama-3-70B-Instruct"
20
  huggingface_api_key = os.getenv("HF_API_TOKEN")
@@ -169,10 +168,10 @@ readable_patient_data = transform_patient_data(patient_data)
169
 
170
  # Toggle visibility of input elements based on input type
171
  def toggle_visibility(input_type):
172
- if input_type == "Voice":
173
- return gr.update(visible=True), gr.update(visible(False))
174
  else:
175
- return gr.update(visible=False), gr.update(visible(True))
176
 
177
  def cleanup_response(response):
178
  # Extract only the part after "Answer:" and remove any trailing spaces
 
7
  from io import BytesIO
8
  import time
9
  import sqlite3
10
+
11
+ # Load environment variables from config.env
12
+ load_dotenv()
13
 
14
  # Configure logging
15
  logging.basicConfig(level=logging.DEBUG)
16
 
 
 
 
17
  # Configure Hugging Face API URL and headers for Meta-Llama-3-70B-Instruct
18
  api_url = "https://api-inference.huggingface.co/models/meta-llama/Meta-Llama-3-70B-Instruct"
19
  huggingface_api_key = os.getenv("HF_API_TOKEN")
 
168
 
169
  # Toggle visibility of input elements based on input type
170
  def toggle_visibility(input_type):
171
+ if (input_type == "Voice"):
172
+ return gr.update(visible=True), gr.update(visible=False)
173
  else:
174
+ return gr.update(visible=False), gr.update(visible=True)
175
 
176
  def cleanup_response(response):
177
  # Extract only the part after "Answer:" and remove any trailing spaces