Spaces:
Sleeping
Sleeping
naveenvenkatesh
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -5,7 +5,7 @@ import mimetypes
|
|
5 |
import requests
|
6 |
import tempfile
|
7 |
import gradio as gr
|
8 |
-
from openai import
|
9 |
import re
|
10 |
import json
|
11 |
from transformers import pipeline
|
@@ -15,7 +15,10 @@ import pandas as pd
|
|
15 |
import json
|
16 |
import plotly.graph_objects as go
|
17 |
|
18 |
-
client =
|
|
|
|
|
|
|
19 |
|
20 |
class SentimentAnalyzer:
|
21 |
def __init__(self):
|
@@ -35,7 +38,7 @@ class SentimentAnalyzer:
|
|
35 |
|
36 |
# Call OpenAI GPT-3.5-turbo
|
37 |
chat_completion = client.chat.completions.create(
|
38 |
-
model = "
|
39 |
messages = conversation,
|
40 |
max_tokens=500,
|
41 |
temperature=0
|
@@ -60,7 +63,7 @@ class SentimentAnalyzer:
|
|
60 |
|
61 |
# Call OpenAI GPT-3.5-turbo
|
62 |
chat_completion = client.chat.completions.create(
|
63 |
-
model = "
|
64 |
messages = conversation,
|
65 |
max_tokens=500,
|
66 |
temperature=0
|
@@ -86,7 +89,7 @@ class Summarizer:
|
|
86 |
|
87 |
# Call OpenAI GPT-3.5-turbo
|
88 |
chat_completion = client.chat.completions.create(
|
89 |
-
model = "
|
90 |
messages = conversation,
|
91 |
max_tokens=500,
|
92 |
temperature=0
|
@@ -174,7 +177,7 @@ class LangChain_Document_QA:
|
|
174 |
|
175 |
# Call OpenAI GPT-3.5-turbo
|
176 |
chat_completion = client.chat.completions.create(
|
177 |
-
model = "
|
178 |
messages = conversation,
|
179 |
max_tokens=300,
|
180 |
temperature=0
|
|
|
5 |
import requests
|
6 |
import tempfile
|
7 |
import gradio as gr
|
8 |
+
from openai import AzureOpenAI
|
9 |
import re
|
10 |
import json
|
11 |
from transformers import pipeline
|
|
|
15 |
import json
|
16 |
import plotly.graph_objects as go
|
17 |
|
18 |
+
self.client = AzureOpenAI(api_key=os.getenv("AZURE_OPENAI_KEY"),
|
19 |
+
api_version="2023-07-01-preview",
|
20 |
+
azure_endpoint = os.getenv("AZURE_OPENAI_ENDPOINT")
|
21 |
+
)
|
22 |
|
23 |
class SentimentAnalyzer:
|
24 |
def __init__(self):
|
|
|
38 |
|
39 |
# Call OpenAI GPT-3.5-turbo
|
40 |
chat_completion = client.chat.completions.create(
|
41 |
+
model = "ChatGPT",
|
42 |
messages = conversation,
|
43 |
max_tokens=500,
|
44 |
temperature=0
|
|
|
63 |
|
64 |
# Call OpenAI GPT-3.5-turbo
|
65 |
chat_completion = client.chat.completions.create(
|
66 |
+
model = "ChatGPT",
|
67 |
messages = conversation,
|
68 |
max_tokens=500,
|
69 |
temperature=0
|
|
|
89 |
|
90 |
# Call OpenAI GPT-3.5-turbo
|
91 |
chat_completion = client.chat.completions.create(
|
92 |
+
model = "ChatGPT",
|
93 |
messages = conversation,
|
94 |
max_tokens=500,
|
95 |
temperature=0
|
|
|
177 |
|
178 |
# Call OpenAI GPT-3.5-turbo
|
179 |
chat_completion = client.chat.completions.create(
|
180 |
+
model = "ChatGPT",
|
181 |
messages = conversation,
|
182 |
max_tokens=300,
|
183 |
temperature=0
|