Kvikontent commited on
Commit
a69d41a
·
verified ·
1 Parent(s): 31f5066

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -15
app.py CHANGED
@@ -37,6 +37,9 @@ def chat(user_message):
37
  str: The AI-generated response (or a message indicating unavailability).
38
  """
39
 
 
 
 
40
  if not genai:
41
  return "AI responses are currently unavailable. Please install `google-generativeai` for this functionality."
42
 
@@ -57,18 +60,4 @@ interface = gr.Interface(
57
  description="Chat with an AI assistant (requires `google-generativeai`)",
58
  )
59
 
60
- interface.launch()
61
-
62
- # Code below is for development/testing purposes only (not required for Gradio app)
63
- if __name__ == "__main__":
64
- if not genai:
65
- print("WARNING: google.generativeai not found. Install with `pip install google-generativeai` for AI-powered responses.")
66
-
67
- genai.configure(api_key='AIzaSyCMBk81YmILNTok8hd6tYtJaevp1qbl6I0') # Replace with your actual API key
68
- model = genai.GenerativeModel('gemini-pro')
69
-
70
- while True:
71
- user_message = input("You: ")
72
- response = chat(user_message)
73
- print(f"AI: {response}")
74
- print("-" * 80)
 
37
  str: The AI-generated response (or a message indicating unavailability).
38
  """
39
 
40
+ genai.configure(api_key='AIzaSyCMBk81YmILNTok8hd6tYtJaevp1qbl6I0') # Replace with your actual API key
41
+ model = genai.GenerativeModel('gemini-pro')
42
+
43
  if not genai:
44
  return "AI responses are currently unavailable. Please install `google-generativeai` for this functionality."
45
 
 
60
  description="Chat with an AI assistant (requires `google-generativeai`)",
61
  )
62
 
63
+ interface.launch()