tanya17 commited on
Commit
e44f530
·
verified ·
1 Parent(s): 097fab2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -10
app.py CHANGED
@@ -16,17 +16,15 @@ import requests
16
  import os
17
 
18
  # Hugging Face API configuration
 
 
19
 
20
- HUGGINGFACE_API_URL = "https://api-inference.huggingface.co/models/declare-lab/flan-alpaca-large"
21
-
22
- HUGGINGFACE_API_KEY = os.environ.get("HUGGINGFACE_API_KEY" )
23
-
24
-
25
-
26
 
27
  def huggingface_chatbot(user_input):
28
  if not HUGGINGFACE_API_KEY:
29
- return "Error: API key not configured."
30
  try:
31
  headers = {
32
  "Authorization": f"Bearer{HUGGINGFACE_API_KEY}",
@@ -45,8 +43,6 @@ def huggingface_chatbot(user_input):
45
  except Exception as e:
46
  return f"Error: {str(e)}"
47
 
48
- FEEDBACK_FILE = "user_feedback.csv"
49
-
50
  # Database setup for user authentication
51
  def init_db():
52
  conn = sqlite3.connect("users.db")
@@ -464,4 +460,4 @@ threading.Thread(target=live_update, daemon=True).start()
464
 
465
  # Launch the app
466
  if __name__ == "__main__":
467
- app.launch(share=False)
 
16
  import os
17
 
18
  # Hugging Face API configuration
19
+ HUGGINGFACE_API_URL = "https://api-inference.huggingface.co/models/google/flan-t5-large"
20
+ HUGGINGFACE_API_KEY = os.environ.get("HUGGINGFACE_API_KEY")
21
 
22
+ # File to store feedback
23
+ FEEDBACK_FILE = "user_feedback.csv"
 
 
 
 
24
 
25
  def huggingface_chatbot(user_input):
26
  if not HUGGINGFACE_API_KEY:
27
+ return "Error: Hugging Face API key not configured."
28
  try:
29
  headers = {
30
  "Authorization": f"Bearer{HUGGINGFACE_API_KEY}",
 
43
  except Exception as e:
44
  return f"Error: {str(e)}"
45
 
 
 
46
  # Database setup for user authentication
47
  def init_db():
48
  conn = sqlite3.connect("users.db")
 
460
 
461
  # Launch the app
462
  if __name__ == "__main__":
463
+ app.launch(share=False)