Spaces:
Sleeping
Sleeping
Craig Pretzinger
commited on
Commit
·
fdec892
1
Parent(s):
0f0f232
Resolved merge conflicts
Browse files
app.py
CHANGED
@@ -7,7 +7,6 @@ import torch
|
|
7 |
import faiss
|
8 |
import numpy as np
|
9 |
import json
|
10 |
-
<<<<<<< Updated upstream
|
11 |
|
12 |
def clean_payload(payload):
|
13 |
# Remove "data:" prefix and clean newline characters
|
@@ -25,7 +24,6 @@ from huggingface_hub import InferenceClient # Keeping Hugging Face Client as re
|
|
25 |
def clean_payload(payload):
|
26 |
cleaned_payload = payload.lstrip("data:").rstrip("\n")
|
27 |
return json.loads(cleaned_payload)
|
28 |
-
>>>>>>> Stashed changes
|
29 |
|
30 |
# API Keys and Org ID
|
31 |
openai.api_key = os.getenv("OPENAI_API_KEY")
|
@@ -82,9 +80,9 @@ def respond(message, system_message, max_tokens, temperature, top_p):
|
|
82 |
)
|
83 |
|
84 |
enhanced_response = ""
|
85 |
-
for chat_message in
|
86 |
-
payload =
|
87 |
-
enhanced_response += payload
|
88 |
|
89 |
# Return both the PubMedBERT result and the enhanced version
|
90 |
return f"Original Info from PubMedBERT: {fda_response}\n\nEnhanced Info via GPT-4o-mini: {enhanced_response}"
|
|
|
7 |
import faiss
|
8 |
import numpy as np
|
9 |
import json
|
|
|
10 |
|
11 |
def clean_payload(payload):
|
12 |
# Remove "data:" prefix and clean newline characters
|
|
|
24 |
def clean_payload(payload):
|
25 |
cleaned_payload = payload.lstrip("data:").rstrip("\n")
|
26 |
return json.loads(cleaned_payload)
|
|
|
27 |
|
28 |
# API Keys and Org ID
|
29 |
openai.api_key = os.getenv("OPENAI_API_KEY")
|
|
|
80 |
)
|
81 |
|
82 |
enhanced_response = ""
|
83 |
+
for chat_message in response['choices']:
|
84 |
+
payload = chat_message['message']['content']
|
85 |
+
enhanced_response += payload
|
86 |
|
87 |
# Return both the PubMedBERT result and the enhanced version
|
88 |
return f"Original Info from PubMedBERT: {fda_response}\n\nEnhanced Info via GPT-4o-mini: {enhanced_response}"
|