Spaces:
Sleeping
Sleeping
Commit
·
f2d0c11
1
Parent(s):
fb31274
first commit
Browse files- app.py +20 -0
- requirements.txt +3 -0
app.py
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from langchain_google_genai import ChatGoogleGenerativeAI
|
2 |
+
from fastapi import FastAPI
|
3 |
+
from typing import Union
|
4 |
+
|
5 |
+
app = FastAPI()
|
6 |
+
|
7 |
+
@app.get("/")
|
8 |
+
def read_root():
|
9 |
+
return {"Hello": "World"}
|
10 |
+
|
11 |
+
llm = ChatGoogleGenerativeAI(model="gemini-pro",google_api_key="AIzaSyAur2W5VT7Q612b_umm26BwQprv8Rky090")
|
12 |
+
|
13 |
+
@app.get("/objects")
|
14 |
+
def read_item():
|
15 |
+
return llm
|
16 |
+
|
17 |
+
@app.get("/test/{text}")
|
18 |
+
def read_item(text):
|
19 |
+
res = llm.invoke(text).content
|
20 |
+
return res
|
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
fastapi
|
2 |
+
langchain_google_genai==1.0.6
|
3 |
+
uvicorn[standard]
|