anithai commited on
Commit
24c4113
·
verified ·
1 Parent(s): e9680dc
Files changed (1) hide show
  1. app.py +1 -5
app.py CHANGED
@@ -1,7 +1,6 @@
1
  import gradio as gr
2
  import pandas as pd
3
  import requests
4
- import os
5
 
6
  # Load keywords and subjects from CSV
7
  def load_keywords(file_path):
@@ -35,11 +34,8 @@ def fetch_response_from_gemini(prompt, api_key):
35
 
36
  response = requests.post(url, headers=headers, json=body)
37
 
38
- print(f"API Response Status Code: {response.status_code}") # Debugging info
39
-
40
  if response.status_code == 200:
41
  result = response.json()
42
- print(f"API Response: {result}") # Debugging info
43
  candidates = result.get("candidates", [])
44
  if candidates:
45
  return candidates[0]["content"]["parts"][0]["text"]
@@ -50,7 +46,7 @@ def fetch_response_from_gemini(prompt, api_key):
50
 
51
  # Main chatbot function
52
  def chatbot(question):
53
- api_key = os.getenv("API_KEY") # Make sure your API key environment variable is set
54
  keyword_map = load_keywords("sylchat_key.csv")
55
 
56
  user_question = question.lower()
 
1
  import gradio as gr
2
  import pandas as pd
3
  import requests
 
4
 
5
  # Load keywords and subjects from CSV
6
  def load_keywords(file_path):
 
34
 
35
  response = requests.post(url, headers=headers, json=body)
36
 
 
 
37
  if response.status_code == 200:
38
  result = response.json()
 
39
  candidates = result.get("candidates", [])
40
  if candidates:
41
  return candidates[0]["content"]["parts"][0]["text"]
 
46
 
47
  # Main chatbot function
48
  def chatbot(question):
49
+ api_key = "AIzaSyANMb7mDPE0Ji9eV1hYC_Yzj8IpYoJW4LE" # Replace with your actual API Key
50
  keyword_map = load_keywords("sylchat_key.csv")
51
 
52
  user_question = question.lower()