jeanflop commited on
Commit
14c0ea3
·
verified ·
1 Parent(s): a8d8d3e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -10
app.py CHANGED
@@ -24,16 +24,10 @@ from PIL import Image
24
 
25
 
26
 
27
- os.environ["HUGGINGFACEHUB_API_TOKEN"] = st.secrets["HUGGINGFACEHUB_API_TOKEN"]
28
- os.environ["GOOGLE_API_KEY"] = st.secrets["GOOGLE_API_KEY"]
 
29
 
30
- # Récupérer la clé API à partir des variables d'environnement
31
- API_KEY = st.secrets["API_KEY"]
32
-
33
- # Vérifier si la clé API est présente
34
- if API_KEY is None:
35
- st.error("La clé API n'est pas définie. Veuillez la définir dans le fichier .env.")
36
- st.stop()
37
 
38
 
39
 
@@ -58,7 +52,7 @@ class Story(BaseModel):
58
 
59
  from langchain_google_genai import ChatGoogleGenerativeAI
60
 
61
- llm = ChatGoogleGenerativeAI(model="gemini-pro",google_api_key=api_key)
62
  model=llm
63
 
64
  system="All instructions must be follow is very important, all story related to african culture and history is mandatory.You are a storyteller who specializes in creating educational tales about African culture. Your mission is to craft a narrative that teaches African children about their rich heritage. Your story is based on real events from the past, incorporating historical references, myths, and legends. story size is short length. Your narrative will be presented in six panels.Very important, For each panel, you will provide: A description of the characters, using precise and unique descriptions each time, ending with the keywords 'high quality', 'watercolor painting', 'painting Benin style', and 'mugshot', 'cartoon africa style' in the scenes or characters is mandatory.For description, using only words or groups of words separated by commas, without sentences. Each sentence in the panel's text should start with the character's name, and each sentence should be no longer than two small sentences. Each story has only three characters. Your story must always revolve around African legends and kingdoms, splitting the scenario into six parts. Be creative in each story"
 
24
 
25
 
26
 
27
+ os.environ["HUGGINGFACEHUB_API_TOKEN"] =HUGGINGFACEHUB_API_TOKEN
28
+ os.environ["GOOGLE_API_KEY"] = GOOGLE_API_KEY
29
+ os.environ["GOOGLE_API_KEY"] = API_KEY
30
 
 
 
 
 
 
 
 
31
 
32
 
33
 
 
52
 
53
  from langchain_google_genai import ChatGoogleGenerativeAI
54
 
55
+ llm = ChatGoogleGenerativeAI(model="gemini-pro",google_api_key=GOOGLE_API_KEY)
56
  model=llm
57
 
58
  system="All instructions must be follow is very important, all story related to african culture and history is mandatory.You are a storyteller who specializes in creating educational tales about African culture. Your mission is to craft a narrative that teaches African children about their rich heritage. Your story is based on real events from the past, incorporating historical references, myths, and legends. story size is short length. Your narrative will be presented in six panels.Very important, For each panel, you will provide: A description of the characters, using precise and unique descriptions each time, ending with the keywords 'high quality', 'watercolor painting', 'painting Benin style', and 'mugshot', 'cartoon africa style' in the scenes or characters is mandatory.For description, using only words or groups of words separated by commas, without sentences. Each sentence in the panel's text should start with the character's name, and each sentence should be no longer than two small sentences. Each story has only three characters. Your story must always revolve around African legends and kingdoms, splitting the scenario into six parts. Be creative in each story"