Spaces:
Runtime error
Runtime error
Qiyuan Gu commited on
bugfix
Browse files
app.py
CHANGED
|
@@ -2,14 +2,14 @@ from openai import OpenAI
|
|
| 2 |
import gradio as gr
|
| 3 |
|
| 4 |
api_key = 'sk-UazEKXLCE5Uyn5jZE068Dd87C19c44Ae912f6a55Ac1b6616'
|
| 5 |
-
client = OpenAI(base_url='https://api.deerapi.com',api_key=api_key)
|
| 6 |
|
| 7 |
description = """
|
| 8 |
# GUI Prompt Debugging Interface
|
| 9 |
|
| 10 |
-
This version **does not** save your prompt editing history
|
| 11 |
|
| 12 |
-
Please **manually** save all the works in a local after finishing debugging a prompt
|
| 13 |
|
| 14 |
Note: Temperature is a parameter that controls the “creativity” or randomness of the text generated. A higher temperature results in more diverse and creative output, while a lower temperature makes the output more deterministic and focused.
|
| 15 |
"""
|
|
@@ -21,6 +21,7 @@ def respond(msg, chat_history, model, system_prompt, patient_profile, temperatur
|
|
| 21 |
history_openai_format.append({"role": "assistant", "content":assistant})
|
| 22 |
history_openai_format.append({"role": "user", "content": msg})
|
| 23 |
completion = client.chat.completions.create(model=model, messages=history_openai_format, max_tokens=200, temperature=temperature)
|
|
|
|
| 24 |
yield completion.choices[0].message.content
|
| 25 |
|
| 26 |
with gr.Blocks(theme=gr.themes.Monochrome(text_size=gr.themes.sizes.text_lg)) as demo:
|
|
|
|
| 2 |
import gradio as gr
|
| 3 |
|
| 4 |
api_key = 'sk-UazEKXLCE5Uyn5jZE068Dd87C19c44Ae912f6a55Ac1b6616'
|
| 5 |
+
client = OpenAI(base_url='https://api.deerapi.com/v1',api_key=api_key)
|
| 6 |
|
| 7 |
description = """
|
| 8 |
# GUI Prompt Debugging Interface
|
| 9 |
|
| 10 |
+
This version **does not** save your prompt editing history.
|
| 11 |
|
| 12 |
+
Please **manually** save all the works in a local after finishing debugging a prompt.
|
| 13 |
|
| 14 |
Note: Temperature is a parameter that controls the “creativity” or randomness of the text generated. A higher temperature results in more diverse and creative output, while a lower temperature makes the output more deterministic and focused.
|
| 15 |
"""
|
|
|
|
| 21 |
history_openai_format.append({"role": "assistant", "content":assistant})
|
| 22 |
history_openai_format.append({"role": "user", "content": msg})
|
| 23 |
completion = client.chat.completions.create(model=model, messages=history_openai_format, max_tokens=200, temperature=temperature)
|
| 24 |
+
print(completion)
|
| 25 |
yield completion.choices[0].message.content
|
| 26 |
|
| 27 |
with gr.Blocks(theme=gr.themes.Monochrome(text_size=gr.themes.sizes.text_lg)) as demo:
|