Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,3 @@
|
|
1 |
-
from transformers import pipeline
|
2 |
import gradio as gr
|
3 |
import openai
|
4 |
|
@@ -16,24 +15,24 @@ def get_openai_response(api_key, model, prompt):
|
|
16 |
|
17 |
def generate_responses(api_key, prompt):
|
18 |
response_gpt3 = get_openai_response(api_key, "gpt-3.5-turbo", prompt)
|
19 |
-
response_gpt4 = get_openai_response(api_key, "gpt-
|
20 |
return response_gpt3, response_gpt4
|
21 |
|
22 |
# Gradio Interface
|
23 |
inputs = [
|
24 |
-
gr.
|
25 |
-
gr.
|
26 |
]
|
27 |
|
28 |
outputs = [
|
29 |
-
gr.
|
30 |
-
gr.
|
31 |
]
|
32 |
|
33 |
gr.Interface(
|
34 |
fn=generate_responses,
|
35 |
inputs=inputs,
|
36 |
outputs=outputs,
|
37 |
-
title="
|
38 |
-
description="Enter your OpenAI API Key and your question to get responses from GPT-3.5
|
39 |
).launch()
|
|
|
|
|
1 |
import gradio as gr
|
2 |
import openai
|
3 |
|
|
|
15 |
|
16 |
def generate_responses(api_key, prompt):
|
17 |
response_gpt3 = get_openai_response(api_key, "gpt-3.5-turbo", prompt)
|
18 |
+
response_gpt4 = get_openai_response(api_key, "gpt-4", prompt)
|
19 |
return response_gpt3, response_gpt4
|
20 |
|
21 |
# Gradio Interface
|
22 |
inputs = [
|
23 |
+
gr.Textbox(label="OpenAI API Key"),
|
24 |
+
gr.Textbox(label="Your Question")
|
25 |
]
|
26 |
|
27 |
outputs = [
|
28 |
+
gr.Textbox(label="GPT-3.5 Turbo Response"),
|
29 |
+
gr.Textbox(label="GPT-4 Response")
|
30 |
]
|
31 |
|
32 |
gr.Interface(
|
33 |
fn=generate_responses,
|
34 |
inputs=inputs,
|
35 |
outputs=outputs,
|
36 |
+
title="AI Prompt Challenge",
|
37 |
+
description="Enter your OpenAI API Key and your question to get responses from GPT-3.5 Turbo and GPT-4 models."
|
38 |
).launch()
|