akhaliq HF staff commited on
Commit
ccda521
·
verified ·
1 Parent(s): ab8a15b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -1,7 +1,6 @@
1
  import os
2
  import google.generativeai as genai
3
  import gradio as gr
4
- from google.generativeai.protos import content_types as protos
5
 
6
  # Configure the API key
7
  genai.configure(api_key=os.environ["YOUR_API_KEY"])
@@ -30,7 +29,8 @@ def chat_with_model(user_input, history):
30
  # Convert history to expected format (list of protos.Content)
31
  formatted_history = []
32
  for entry in history:
33
- content = protos.Content(text=entry["content"], role=entry["role"])
 
34
  formatted_history.append(content)
35
 
36
  # Start or continue the chat session using the formatted history
 
1
  import os
2
  import google.generativeai as genai
3
  import gradio as gr
 
4
 
5
  # Configure the API key
6
  genai.configure(api_key=os.environ["YOUR_API_KEY"])
 
29
  # Convert history to expected format (list of protos.Content)
30
  formatted_history = []
31
  for entry in history:
32
+ # Assuming the message content is a string
33
+ content = genai.protos.Content(text=entry["content"], role=entry["role"])
34
  formatted_history.append(content)
35
 
36
  # Start or continue the chat session using the formatted history