Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,7 +5,7 @@ import streamlit as st
|
|
| 5 |
import pandas as pd
|
| 6 |
import openai
|
| 7 |
import os
|
| 8 |
-
from langchain
|
| 9 |
from langchain.chains import LLMChain
|
| 10 |
from langchain.prompts import PromptTemplate
|
| 11 |
|
|
@@ -30,10 +30,10 @@ def get_coordinates(location_name):
|
|
| 30 |
template="Provide the latitude and longitude for {location}."
|
| 31 |
)
|
| 32 |
|
| 33 |
-
llm = OpenAI(model_name="gpt-4",
|
| 34 |
chain = LLMChain(llm=llm, prompt=prompt_template)
|
| 35 |
|
| 36 |
-
result = chain.run(location_name).strip()
|
| 37 |
coordinates = result.split(",")
|
| 38 |
return float(coordinates[0]), float(coordinates[1])
|
| 39 |
|
|
|
|
| 5 |
import pandas as pd
|
| 6 |
import openai
|
| 7 |
import os
|
| 8 |
+
from langchain import OpenAI
|
| 9 |
from langchain.chains import LLMChain
|
| 10 |
from langchain.prompts import PromptTemplate
|
| 11 |
|
|
|
|
| 30 |
template="Provide the latitude and longitude for {location}."
|
| 31 |
)
|
| 32 |
|
| 33 |
+
llm = OpenAI(model_name="gpt-4", api_key=openai.api_key)
|
| 34 |
chain = LLMChain(llm=llm, prompt=prompt_template)
|
| 35 |
|
| 36 |
+
result = chain.run(location=location_name).strip()
|
| 37 |
coordinates = result.split(",")
|
| 38 |
return float(coordinates[0]), float(coordinates[1])
|
| 39 |
|