Spaces:
Runtime error
Runtime error
updated README
Browse files- README.md +1 -1
- main.py +10 -15
- requirements.txt +1 -1
README.md
CHANGED
@@ -4,7 +4,7 @@ emoji: "🧪"
|
|
4 |
colorFrom: "#009FFD"
|
5 |
colorTo: "#2A2A72"
|
6 |
sdk: "gradio"
|
7 |
-
sdk_version: "3.
|
8 |
python_version: "3.9"
|
9 |
app_file: main.py
|
10 |
pinned: false
|
|
|
4 |
colorFrom: "#009FFD"
|
5 |
colorTo: "#2A2A72"
|
6 |
sdk: "gradio"
|
7 |
+
sdk_version: "3.32.0"
|
8 |
python_version: "3.9"
|
9 |
app_file: main.py
|
10 |
pinned: false
|
main.py
CHANGED
@@ -51,18 +51,13 @@ with open("data/patients.json") as f:
|
|
51 |
|
52 |
patients_names = [el["name"] for el in patiens]
|
53 |
|
54 |
-
|
55 |
-
# chat: ChatOpenAI
|
56 |
-
# message: str
|
57 |
-
# chatbot_messages: ChatHistory
|
58 |
-
# messages: List[BaseMessage]
|
59 |
-
# -> -> Tuple[ChatOpenAI, str, ChatHistory, List[BaseMessage]]
|
60 |
def message_handler(
|
61 |
-
chat,
|
62 |
-
message,
|
63 |
-
chatbot_messages,
|
64 |
-
messages,
|
65 |
-
) :
|
66 |
if chat is None:
|
67 |
# in the queue we will store our streamed tokens
|
68 |
queue = Queue()
|
@@ -115,8 +110,8 @@ def on_clear_click() -> Tuple[str, List, List]:
|
|
115 |
|
116 |
|
117 |
def on_done_click(
|
118 |
-
chatbot_messages, patient, user
|
119 |
-
):
|
120 |
logging.info(f"Saving chat for user={user}")
|
121 |
add_chat_by_uid(
|
122 |
client, Chat(patient=patient, messages=chatbot_messages), user["uid"]
|
@@ -124,7 +119,7 @@ def on_done_click(
|
|
124 |
return on_clear_click()
|
125 |
|
126 |
|
127 |
-
def on_apply_settings_click(model_name, temperature):
|
128 |
logging.info(
|
129 |
f"Applying settings: model_name={model_name}, temperature={temperature}"
|
130 |
)
|
@@ -148,7 +143,7 @@ def on_drop_down_change(selected_item, messages):
|
|
148 |
|
149 |
|
150 |
def on_demo_load(url_params):
|
151 |
-
username = url_params
|
152 |
logging.info(f"Getting user for username={username}")
|
153 |
create_user(client, User(username=username, uid=None))
|
154 |
user = get_user_by_username(client, username)
|
|
|
51 |
|
52 |
patients_names = [el["name"] for el in patiens]
|
53 |
|
54 |
+
|
|
|
|
|
|
|
|
|
|
|
55 |
def message_handler(
|
56 |
+
chat: Optional[ChatOpenAI],
|
57 |
+
message: str,
|
58 |
+
chatbot_messages: ChatHistory,
|
59 |
+
messages: List[BaseMessage],
|
60 |
+
) -> Tuple[ChatOpenAI, str, ChatHistory, List[BaseMessage]]:
|
61 |
if chat is None:
|
62 |
# in the queue we will store our streamed tokens
|
63 |
queue = Queue()
|
|
|
110 |
|
111 |
|
112 |
def on_done_click(
|
113 |
+
chatbot_messages: ChatHistory, patient: str, user: User
|
114 |
+
) -> Tuple[str, List, List]:
|
115 |
logging.info(f"Saving chat for user={user}")
|
116 |
add_chat_by_uid(
|
117 |
client, Chat(patient=patient, messages=chatbot_messages), user["uid"]
|
|
|
119 |
return on_clear_click()
|
120 |
|
121 |
|
122 |
+
def on_apply_settings_click(model_name: str, temperature: float):
|
123 |
logging.info(
|
124 |
f"Applying settings: model_name={model_name}, temperature={temperature}"
|
125 |
)
|
|
|
143 |
|
144 |
|
145 |
def on_demo_load(url_params):
|
146 |
+
username = url_params.get("username", "test")
|
147 |
logging.info(f"Getting user for username={username}")
|
148 |
create_user(client, User(username=username, uid=None))
|
149 |
user = get_user_by_username(client, username)
|
requirements.txt
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
gradio==3.
|
2 |
openai
|
3 |
elevenlabs
|
4 |
python-dotenv
|
|
|
1 |
+
gradio==3.32.0
|
2 |
openai
|
3 |
elevenlabs
|
4 |
python-dotenv
|