Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -33,15 +33,12 @@ def scrape_website(url):
|
|
| 33 |
|
| 34 |
def send_to_chatgpt(api_key, prompt_file, transcript):
|
| 35 |
try:
|
| 36 |
-
|
| 37 |
-
with open(prompt_file, 'r', encoding='utf-8') as file:
|
| 38 |
-
prompt = file.read().strip()
|
| 39 |
-
|
| 40 |
openai.api_key = api_key
|
| 41 |
response = openai.ChatCompletion.create(
|
| 42 |
model="gpt-4-1106-preview",
|
| 43 |
messages=[
|
| 44 |
-
{"role": "system", "content":
|
| 45 |
{"role": "system", "content": transcript}
|
| 46 |
],
|
| 47 |
)
|
|
@@ -53,7 +50,7 @@ st.title("Webseiten-Scraper")
|
|
| 53 |
# Beispiel für die Verwendung der Funktion
|
| 54 |
|
| 55 |
api_key = os.getenv("api_key") # Setzen Sie hier Ihren OpenAI-API-Schlüssel ein
|
| 56 |
-
base_prompt =
|
| 57 |
csv_name = "results.csv"
|
| 58 |
|
| 59 |
|
|
|
|
| 33 |
|
| 34 |
def send_to_chatgpt(api_key, prompt_file, transcript):
|
| 35 |
try:
|
| 36 |
+
|
|
|
|
|
|
|
|
|
|
| 37 |
openai.api_key = api_key
|
| 38 |
response = openai.ChatCompletion.create(
|
| 39 |
model="gpt-4-1106-preview",
|
| 40 |
messages=[
|
| 41 |
+
{"role": "system", "content": prompt_file},
|
| 42 |
{"role": "system", "content": transcript}
|
| 43 |
],
|
| 44 |
)
|
|
|
|
| 50 |
# Beispiel für die Verwendung der Funktion
|
| 51 |
|
| 52 |
api_key = os.getenv("api_key") # Setzen Sie hier Ihren OpenAI-API-Schlüssel ein
|
| 53 |
+
base_prompt = os.getenv("prompt")
|
| 54 |
csv_name = "results.csv"
|
| 55 |
|
| 56 |
|