Spaces:
Sleeping
Sleeping
Commit
·
3d19ff4
1
Parent(s):
cf978fc
test deepseek
Browse files- app.py +36 -36
- requirements.txt +2 -1
app.py
CHANGED
|
@@ -3,47 +3,47 @@ import gradio as gr # type: ignore
|
|
| 3 |
import openai # type: ignore
|
| 4 |
# import os
|
| 5 |
|
| 6 |
-
# openai.api_key = os.getenv("OPENAI_API_KEY")
|
| 7 |
-
client = openai.OpenAI()
|
| 8 |
-
def respond(
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
|
| 19 |
-
|
| 20 |
-
|
| 21 |
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
|
| 48 |
import torch
|
| 49 |
from transformers import AutoTokenizer, AutoModelForCausalLM, GenerationConfig
|
|
|
|
| 3 |
import openai # type: ignore
|
| 4 |
# import os
|
| 5 |
|
| 6 |
+
# # openai.api_key = os.getenv("OPENAI_API_KEY")
|
| 7 |
+
# client = openai.OpenAI()
|
| 8 |
+
# def respond(
|
| 9 |
+
# message,
|
| 10 |
+
# history: list[tuple[str, str]],
|
| 11 |
+
# system_message,
|
| 12 |
+
# max_tokens,
|
| 13 |
+
# temperature,
|
| 14 |
+
# top_p,
|
| 15 |
+
# image_uploaded,
|
| 16 |
+
# file_uploaded
|
| 17 |
+
# ):
|
| 18 |
|
| 19 |
+
# #read system message
|
| 20 |
+
# messages = [{"role": "system", "content": system_message}]
|
| 21 |
|
| 22 |
+
# #read history
|
| 23 |
+
# for val in history:
|
| 24 |
+
# if val[0]:
|
| 25 |
+
# messages.append({"role": "user", "content": val[0]})
|
| 26 |
+
# if val[1]:
|
| 27 |
+
# messages.append({"role": "assistant", "content": val[1]})
|
| 28 |
|
| 29 |
+
# #read output
|
| 30 |
+
# messages.append({"role": "user", "content": message})
|
| 31 |
+
# print("## Messages: \n", messages) #debug output
|
| 32 |
|
| 33 |
+
# #create output
|
| 34 |
+
# response = client.responses.create(
|
| 35 |
+
# model="gpt-4.1-nano",
|
| 36 |
+
# input=messages,
|
| 37 |
+
# temperature=temperature,
|
| 38 |
+
# top_p=top_p,
|
| 39 |
+
# max_output_tokens=max_tokens
|
| 40 |
+
# )
|
| 41 |
|
| 42 |
+
# #read output
|
| 43 |
+
# response = response.output_text
|
| 44 |
+
# print("## Response: ", response) #debug output
|
| 45 |
+
# print("\n")
|
| 46 |
+
# yield response #chat reply
|
| 47 |
|
| 48 |
import torch
|
| 49 |
from transformers import AutoTokenizer, AutoModelForCausalLM, GenerationConfig
|
requirements.txt
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
gradio
|
| 2 |
openai
|
| 3 |
torch
|
| 4 |
-
transformers
|
|
|
|
|
|
| 1 |
gradio
|
| 2 |
openai
|
| 3 |
torch
|
| 4 |
+
transformers
|
| 5 |
+
accelerate
|