Update app.py
Browse files
app.py
CHANGED
|
@@ -8,9 +8,9 @@ import os
|
|
| 8 |
#load API key
|
| 9 |
os.environ["GOOGLE_API_KEY"] = os.environ.get("GOOGLE_API_KEY")
|
| 10 |
|
| 11 |
-
#
|
| 12 |
model = ChatGoogleGenerativeAI(
|
| 13 |
-
model="gemini-
|
| 14 |
temperature=0.5
|
| 15 |
)
|
| 16 |
|
|
@@ -22,10 +22,10 @@ template = PromptTemplate(
|
|
| 22 |
|
| 23 |
parser = StrOutputParser()
|
| 24 |
|
| 25 |
-
#
|
| 26 |
chain = template | model | parser
|
| 27 |
|
| 28 |
-
#
|
| 29 |
def generate_facts(topic):
|
| 30 |
try:
|
| 31 |
result = chain.invoke({'topic': topic})
|
|
|
|
| 8 |
#load API key
|
| 9 |
os.environ["GOOGLE_API_KEY"] = os.environ.get("GOOGLE_API_KEY")
|
| 10 |
|
| 11 |
+
#here using of the Google Model because for me huggingface model is not working, due to some api issue.
|
| 12 |
model = ChatGoogleGenerativeAI(
|
| 13 |
+
model="models/gemini-1.5-flash-latest",
|
| 14 |
temperature=0.5
|
| 15 |
)
|
| 16 |
|
|
|
|
| 22 |
|
| 23 |
parser = StrOutputParser()
|
| 24 |
|
| 25 |
+
# create the chain
|
| 26 |
chain = template | model | parser
|
| 27 |
|
| 28 |
+
# now creating of the gradio app
|
| 29 |
def generate_facts(topic):
|
| 30 |
try:
|
| 31 |
result = chain.invoke({'topic': topic})
|