Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -40,12 +40,50 @@
|
|
40 |
|
41 |
# iface.launch()
|
42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
import gradio as gr
|
44 |
import requests
|
45 |
import openai
|
46 |
import os
|
47 |
|
48 |
-
def function(Textbox,Textbox3):
|
49 |
target = os.environ.get("target")
|
50 |
target2 = os.environ.get("target2")
|
51 |
openai.api_key = target2
|
@@ -57,7 +95,7 @@ def function(Textbox,Textbox3):
|
|
57 |
{"role": "system", "content": content},
|
58 |
]
|
59 |
messages.append(
|
60 |
-
|
61 |
)
|
62 |
chat = openai.ChatCompletion.create(
|
63 |
model="gpt-3.5-turbo", messages=messages
|
@@ -70,7 +108,7 @@ def function(Textbox,Textbox3):
|
|
70 |
|
71 |
inputs = [
|
72 |
gr.inputs.Textbox(label="Textbox",type="text"),
|
73 |
-
|
74 |
gr.inputs.Textbox(label="Textbox3",type="password")
|
75 |
]
|
76 |
|
|
|
40 |
|
41 |
# iface.launch()
|
42 |
|
43 |
+
# import gradio as gr
|
44 |
+
# import requests
|
45 |
+
# import openai
|
46 |
+
# import os
|
47 |
+
|
48 |
+
# def function(Textbox,Textbox3):
|
49 |
+
# target = os.environ.get("target")
|
50 |
+
# target2 = os.environ.get("target2")
|
51 |
+
# openai.api_key = target2
|
52 |
+
# content = os.environ.get("content")
|
53 |
+
# # model = os.environ.get("model")
|
54 |
+
# # hrc = os.environ.get("hrc")
|
55 |
+
# if Textbox3 == target:
|
56 |
+
# messages = [
|
57 |
+
# {"role": "system", "content": content},
|
58 |
+
# ]
|
59 |
+
# messages.append(
|
60 |
+
# {"role": "user", "content": Textbox},
|
61 |
+
# )
|
62 |
+
# chat = openai.ChatCompletion.create(
|
63 |
+
# model="gpt-3.5-turbo", messages=messages
|
64 |
+
# )
|
65 |
+
# reply = chat.choices[0].message.content
|
66 |
+
# messages.append({"role": "assistant", "content": reply})
|
67 |
+
# return reply
|
68 |
+
# else:
|
69 |
+
# return "Failed"
|
70 |
+
|
71 |
+
# inputs = [
|
72 |
+
# gr.inputs.Textbox(label="Textbox",type="text"),
|
73 |
+
# # gr.inputs.Textbox(label="Textbox2",type="text"),
|
74 |
+
# gr.inputs.Textbox(label="Textbox3",type="password")
|
75 |
+
# ]
|
76 |
+
|
77 |
+
# iface = gr.Interface(fn=function, inputs=inputs, outputs="text")
|
78 |
+
|
79 |
+
# iface.launch()
|
80 |
+
|
81 |
import gradio as gr
|
82 |
import requests
|
83 |
import openai
|
84 |
import os
|
85 |
|
86 |
+
def function(Textbox,Textbox2,Textbox3):
|
87 |
target = os.environ.get("target")
|
88 |
target2 = os.environ.get("target2")
|
89 |
openai.api_key = target2
|
|
|
95 |
{"role": "system", "content": content},
|
96 |
]
|
97 |
messages.append(
|
98 |
+
Textbox2
|
99 |
)
|
100 |
chat = openai.ChatCompletion.create(
|
101 |
model="gpt-3.5-turbo", messages=messages
|
|
|
108 |
|
109 |
inputs = [
|
110 |
gr.inputs.Textbox(label="Textbox",type="text"),
|
111 |
+
gr.inputs.Textbox(label="Textbox2",type="text"),
|
112 |
gr.inputs.Textbox(label="Textbox3",type="password")
|
113 |
]
|
114 |
|