Spaces:
Paused
Paused
deepakaitcs
commited on
Commit
·
24c1914
1
Parent(s):
3c928a2
first
Browse files- .gitignore +1 -0
- app.py +29 -0
- requirements.txt +0 -0
.gitignore
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
.env
|
app.py
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# import openai
|
2 |
+
from langchain_openai.llms import OpenAI
|
3 |
+
from dotenv import load_dotenv
|
4 |
+
import os
|
5 |
+
|
6 |
+
from langchain_core.prompts import PromptTemplate
|
7 |
+
from langchain.chains import LLMChain
|
8 |
+
|
9 |
+
|
10 |
+
# os.environ["OPENAPI_KEY"]='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'
|
11 |
+
load_dotenv()
|
12 |
+
api_key = os.environ['OPEN_API_KEY'];
|
13 |
+
llm = OpenAI(openai_api_key=api_key)
|
14 |
+
|
15 |
+
mytemplate = """Question: {question}
|
16 |
+
Answer: Let's think step by step."""
|
17 |
+
|
18 |
+
# prompt = PromptTemplate.from_template(mytemplate)
|
19 |
+
|
20 |
+
# mychain = LLMChain(llm=llm, prompt=prompt)
|
21 |
+
|
22 |
+
# question ="who is fastest man on earth?"
|
23 |
+
# print(mychain.run(question))
|
24 |
+
|
25 |
+
result= llm.generate(['two hit movies of bollywood ', 'two flop movies of bollywood'])
|
26 |
+
|
27 |
+
print(result.llm_output)
|
28 |
+
print(result.generations[1][0].text)
|
29 |
+
|
requirements.txt
ADDED
File without changes
|